sindresorhus/gulp-mocha — pull request #58 by abalmos (2014-09-28 05:35:59+00:00)
Title: Pass async test AssertionError exception to Mocha

Exceptions are caught by gulp-mocha and translated into a gulp PluginError.
However, some are valid from a asynchronous Mocha tests and if they are not
passed back to the Mocha runner the tests fail from timeout. It should at least
pass AssertionError back to Mocha to make gulp-mocha and mocha output
consistent.

Without this commit the extraneous PluginError kills the gulp task before Mocha
finishes. It also causes gulp watch tasks to "finish" before the Mocha runner
completes.

This commit calls the internal "uncaught" function of the Mocha runner. There
may be a better way. However, it seems this is how Mocha's runner already works,
it is just gulp-mocha catches it before Mocha's uncaught exception listener gets
a hold of it.