I have been using a little module from Isaac Schlueter named Supervisor for continuous testing.
Suppose you have a Makefile like this:
REPORTER ?= spec test: @clear && reset ./node_modules/.bin/mocha --reporter $(REPORTER) .PHONY: all test clean
You can add another target as follows:
watch: ./node_modules/.bin/supervisor -q -n exit -e 'node|js|json|config' -x make test
The parameters means:
- q: quiet (supress debug messages)
- n: no restart on exit
- e: watch for changes in these extensions
- x: the executable for this will be make
- test: the name of the thing we want to execute with make
This works pretty well for me, mocha has an option for continuous testing -w but it is very broken because it runs everything on the same node process.