Install the supervisor package using npm.
$ npm install -g supervisor
Start the watch process in the root directory of your package:
$ supervisor -q -n exit -w spec -x npm test
-n exit: means that the test should not restart when they are finished. They should only run when a file of the suite changed.
-w spec: The directory where the files of the testsuite is located.
-x npm test: The command that should be executed when a file in the
spec directory changed. In this case we assume that the command to run the testsuite is specified in the package.json and so we can use
npm test to execute the tests.