Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Export top-level suite on global mocha object (mocha.suite). Closes #448

Jo Liss2952bee1e1b3
diff --git a/support/tail.js b/support/tail.js
index 468b37da..7bfe4c00 100644
--- a/support/tail.js
+++ b/support/tail.js
@@ -68,10 +68,11 @@ window.mocha = require('mocha');
// boot
;(function(){
- var suite = new mocha.Suite('', new mocha.Context)
- , utils = mocha.utils
+ var utils = mocha.utils
, options = {}
+ mocha.suite = new mocha.Suite('', new mocha.Context());
+
/**
* Highlight the given string of `js`.
*/
@@ -124,9 +125,9 @@ window.mocha = require('mocha');
ui = mocha.interfaces[options.ui];
if (!ui) throw new Error('invalid mocha interface "' + ui + '"');
- if (options.timeout) suite.timeout(options.timeout);
- ui(suite);
- suite.emit('pre-require', window);
+ if (options.timeout) mocha.suite.timeout(options.timeout);
+ ui(mocha.suite);
+ mocha.suite.emit('pre-require', window);
};
/**
@@ -134,8 +135,8 @@ window.mocha = require('mocha');
*/
mocha.run = function(fn){
- suite.emit('run');
- var runner = new mocha.Runner(suite);
+ mocha.suite.emit('run');
+ var runner = new mocha.Runner(mocha.suite);
var Reporter = options.reporter || mocha.reporters.HTML;
var reporter = new Reporter(runner);
var query = parse(window.location.search || "");