zootella/node — pull request #1 by mnutt (2013-02-16 16:26:50+00:00)
Title: Watch test files and re-run when changes have been made

I created a bin directory with symlinks to nodeunit to make it easier to run. (not sure if this works on windows, but it should definitely work on mac)

I added nodeunit and nodeunit-watcher as dependencies to the package.json, so you should be able to run `npm install` in the project root and it will make sure both are installed.

You can run `npm test` to actually invoke nodeunit-watcher. (it's just an npm alias defined in package.json)

nodeunit-watcher is a fairly naive approach to continuous testing; it only looks at the tests themselves to see if they need to be re-run. Something like rails' autotest is much smarter and will figure out when you change a file and run its corresponding test, though that only works because rails has a specific directory structure. The node tests you write will probably be so quick that you just want to re-run the entire thing anyway.