Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Accept a ready function in mocha.run(), just like Mocha.prototype.run.

Arian Stolwijke45240141fd2
diff --git a/support/tail.js b/support/tail.js
index a98b1d11..680cb8ab 100644
--- a/support/tail.js
+++ b/support/tail.js
@@ -1,4 +1,3 @@
-
/**
* Node shims.
*
@@ -133,7 +132,7 @@ window.mocha = require('mocha');
* Run mocha, returning the Runner.
*/
- mocha.run = function(){
+ mocha.run = function(fn){
suite.emit('run');
var runner = new mocha.Runner(suite);
var Reporter = options.reporter || mocha.reporters.HTML;
@@ -144,6 +143,7 @@ window.mocha = require('mocha');
if (options.globals) runner.globals(options.globals);
runner.globals(['location']);
runner.on('end', highlightCode);
+ if (fn) runner.on('end', fn);
return runner.run();
};
})();