I'd like to be able to run unit tests faster, and also have them run continuously in the background in watch mode, similar to what npm run dev does.
To do that, I switched the test running from Karma -> mocha-webpack, and from PhantomJS to JSDOM. PR #874 has the code changes. Coverage reports are maintained using nyc.
I added a new command npm run unit:watch that monitors for code changes continuously in the background, and re-runs any affected unit tests (see http://zinserjan.github.io/mocha-webpack/#watch-mode-watch).
Any interest in merging this PR? Or in making it an option for vue init?
Hey, thanks for tour contribution.
However we are coherently evaluating if we want to a itch karma for something else, but haven't decided yet.
So this issue + PR will have to wait until we have settled on the future solution.
how about setting autoWatch to be true in karma.conf.js, or using CLI options --auto-watch in the package.json
// package.json
"unit:watch": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --auto-watch",
This should be the simplest way to achieve the goal
References: http://karma-runner.github.io/1.0/config/configuration-file.html
Update: We will swithc to jest (#817), so as explained in #874, this will not be happening.
We did our custom unit testing setup, without karma and webpack so we don't need to wait minutes for building the bundle, launching browser etc. All is working perfectly and fast with just Node, jsdom to simulate browser, Mocha. I wish such setup would be there by default in vue-webpack-template
Most helpful comment
how about setting
autoWatchto be true in karma.conf.js, or using CLI options--auto-watchin the package.jsonThis should be the simplest way to achieve the goal
References: http://karma-runner.github.io/1.0/config/configuration-file.html