Time flies and is already June 2018. Since there is not much documentation on the Internet about this, I want to give out my 2 cents.
I currently have a setting in which I link my tests to the change tracking web package to automatically restart the tests.
I use karma-webpack using the configuration described in the Alternate Use section , and I think this is the right way to solve the problem asked in the question.
karma.conf.js
{
...
files: [
// only specify one entry point
// and require all tests in there
'test/index_test.js'
],
preprocessors: {
// add webpack as preprocessor
'test/index_test.js': [ 'webpack' ]
},
...
}
test / index_test.js
// require all modules ending in "_test" from the
// current directory and all subdirectories
const testsContext = require.context(".", true, /_test$/)
testsContext.keys().forEach(testsContext)
, @Adi Prasetyo, , . , , , URL.
, ( , , ), webpack-dev-middleware, , - . , :
karma.config.js
{
...
webpackMiddleware: {
watchOptions: {
aggregateTimeout: 300,
poll: 1000, // customize depending on PC power
},
},
...
}
.