Running the whole set of unit tests with npm run unit
everytime you make a change to a component takes several seconds. This definitely doesn’t fit my “code a little, test a little” workflow. Before I wanted to dive into webpack and the karma setup to employ something like a watch mode, I searched the Internet and found a neat solution to achieve the goal:
Karma, the spectacular test runner for JavaScript, has an autoWatch
option, which I added to my package.json
file like this:
"unit:watch": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --auto-watch",