visionmedia/mocha — pull request #833 by jeffomatic (2013-05-03 07:56:12+00:00)
Title: Add optional cooldown period between watch test runs

Mocha's default watch behavior is a bit too indiscriminate, and will trigger re-runs of your test on any filesystem event. This is bad if you have other watch/guard-type services that modify the local filesystem, such as a CoffeeScript compiler. Such cases can trigger a cascade of tests, which are at best redundant and at worst cause test failures (e.g. when near-simultaneous test runs attempt to bind the same socket, etc.).

This commit adds an optional cooldown period between test runs, which
should help eliminate redundancy.

Usage:

mocha -w --watch-cooldown 500 test/foobar.js