Skip to content

Commit

Permalink
Export top-level suite on global mocha object (mocha.suite). Closes #448
Browse files Browse the repository at this point in the history


This should probably be tested, since it's an API that we'll rely on in
Konacha, but I'm not sure what's the best way to do so.
  • Loading branch information
joliss committed Jun 18, 2012
1 parent a64946c commit 2952bee
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions support/tail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
*/
Expand Down Expand Up @@ -124,18 +125,18 @@ 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);
};

/**
* Run mocha, returning the Runner.
*/

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 || "");
Expand Down

0 comments on commit 2952bee

Please sign in to comment.