12 comments

[ 3.0 ms ] story [ 47.1 ms ] thread
Pretty amazing, but there's one feature all test runners seem to ignore, and that's persistent watching. And the ones that _do_ support it just run pretty much _everything_ on each save.

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.

(comment deleted)
Scala.js with sbt supports persistent watching with running only what actually changed. And it runs tests in parallel by default. And that works for all testing frameworks. Oh and most testing frameworks support asynchronous tests (what ava calls "Planned assertions").

One command: "sbt ~testQuick".

AVA author here. Not ignored, just not implemented yet. AVA is still in its infancy and we're prioritizing getting the core settled first. We're are thinking of doing something even more ambitious, though. Naive watching is easy, but we want to tackle incremental testing, so you only have to run the tests that was affected by code changes since the last run. See https://github.com/sindresorhus/ava/issues/115 for more.

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 :)

Thanks! I'll look this project closely from now on and try to contribute to best of my abilities! :)
Another member of the AVA team here. As Sindre said, watch is certainly on our radar. But so is speed. We have every intention of optimizing which tests run and delivering feedback within milliseconds. Someday soon, I hope the answer to Javascript test optimization is "use AVA".
I'm 100% with you.

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.

Recently contributed to this project. Sindre is a great and friendly guy, and ava has a lot of potential.