This project with an accompanyingblog post demonstrates how to use Karma with React.js but when you run npm run test
Karma opens the browser very quickly and shuts it down almost as quickly, not allowing you to debug the application (which its supposed to do). I changed the config to singleRun: false
, thinking it might be singleRun
that's shutting the application down.
I also added autoWatch: true
hoping it would keep the test results visible but that didn't work either.
Question: how to get karma to keep the browser open long enough to view the test results and debug the application?
This is the karma.config.js file
var webpack = require('webpack');
module.exports = function (config) {
config.set({
// browsers: [ process.env.CONTINUOUS_INTEGRATION ? 'Firefox' : 'Chrome' ],
browsers: [ 'Chrome' ],
singleRun: true,
// autoWatch: true,
frameworks: [ 'mocha' ],
files: [
'tests.webpack.js'
],
preprocessors: {
'tests.webpack.js': [ 'webpack', 'sourcemap' ]
},
reporters: [ 'dots' ],
webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader' }
]
}
},
webpackServer: {
noInfo: true
}
});
};