by tzaman · 11y ago · 0 comments
My development process looks like this:
- run the watcher
- save a source/test file
- if the file is in /test/ dir, then the suite is ran
- if the file is in /src/ dir, then it is instrumented (and the instrumented source replaces require cache
- once the suite is done running, a coverage report (Istanbul ftw!) is built both in html and console versions.e
- Every save only takes a few milliseconds to generate the feedback/output, which is really important to me
It took some time, but got it working eventually: https://medium.com/@TomazZaman/how-to-get-fast-unit-tests-wi...
Now the question I have at this point is: Is it only me who has this kind of requirements? Because I've Googled a lot (A-LOT!) and there's simply no Javascript test optimization techniques out there. At least none people would write about.
We're happy to receive issues if there's anything else that bothers you. We also have a Gitter chat if you'd like to discuss: https://gitter.im/sindresorhus/ava :)
In the meantime, there's Wallaby: http://wallabyjs.com/
One command: "sbt ~testQuick".
As mentioned below, Wallaby.JS does it for Javascript, and on the .NET side at least there's NCrunch [1] and recently Resharper added their own take on it [2]
[2] https://blog.jetbrains.com/dotnet/2015/09/01/resharper-10-ea...
https://github.com/sindresorhus/gulp-ava https://github.com/sindresorhus/grunt-ava
Using Webpack and Mocha, I run `npm test:watch -- test/some/thing.js` which builds just that test's bundle and runs it with Mocha. If there's a change, the bundle is refreshed and Mocha reruns it.
It took more effort to accomplish than I would like, but I didn't find any alternatives at the time for Webpack users.