visionmedia/mocha — pull request #1124 by reid (2014-02-03 23:40:18+00:00)
Title: Deferred execution (2014)

This is @tarruda's #719 pull request from last year updated to cleanly merge. All tests pass.

From the original request:

> This should solve issue #362.

> A global 'wait' function is added so the test files can pause mocha processing and generate
tests asynchronously. The function returns a semaphore with a single method 'resume' to continue processing test files.

@travisjeffery This pull request implements [TJ's suggestion](https://github.com/visionmedia/mocha/issues/362#issuecomment-7660612) for fixing #362 and includes a test. Can this be included in Mocha? Deferred execution has [inspired Mocha forks](https://github.com/visionmedia/mocha/issues/362#issuecomment-6095691) and prevents test runners like [Yeti](http://yeti.cx) from [running async-defined Mocha tests](https://github.com/yui/yeti/pull/75). Thank you!

/cc @alex-seville