karma
karma copied to clipboard
Autowatch not working with karma-webpack on karma version 4.0
- Operating System: Linux Mint
- Node Version: 10.15.1
- NPM Version: 6.4.1
- webpack Version: 3.6.0
- karma-webpack Version: 3.0.5
Expected Behavior
Webpack rebuild bundle on file change when karma-webpack is used with Karma 4.0
Actual Behavior
Nothing happens, Karma notice file change, but test bundle don't change
Code
// Part of my karma.conf.js
module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: [{
pattern: 'test/**/*.spec.js'
}],
preprocessors: {
'test/**/*.spec.js': ['webpack', 'sourcemap']
},
webpack: {
// ...
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: path.join(__dirname, 'node_modules')
},
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
}
},
// ...
})
}
How Do We Reproduce?
My karma config watches on files placed inside test
folder. When I save change in folder, webpack doesn't get changes and test run on old files
https://github.com/karma-runner/karma/issues/3226 - Seems to be connected with this issue.
Fix
Downgrade Karma to 3.1.4 version fixed the problem.
Still seeing this on v6.. autoWatch has no effect. Karma simply exits after running tests.