Initialize a Webpack Project with Karma for Testing
$ npm install --save-dev karma karma-chrome-launcher mocha karma-mocha
Then run the init script for karma:
$ ./node_modules/.bin/karma init
chose:
>mocha
require.js :
>no
browsers:
>Chrome
location:
src/js/**/*.test.js
(creates controller.test.js in the same dir as controller.js.)exclude:
>
(empty)watch:
>no
(will add the watcher elsewhere)this creates the karma.conf.js file. He cleans it up, to arrive to this config:
module.exports = function setKarmaConfig(config) {
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'src/js/**/*.test.js'
],
exclude : [
]
})
}