Skip to content

Commit

Permalink
suite constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Jan 10, 2019
1 parent f223298 commit c458e21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Mocha(options) {
this.files = [];
this.options = options;
// root suite
this.suite = new exports.Suite('', new exports.Context());
this.suite = new exports.Suite('', new exports.Context(), true);

if ('useColors' in options) {
utils.deprecate(
Expand Down
7 changes: 4 additions & 3 deletions lib/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ exports.create = function(parent, title) {
};

/**
* Initialize a new `Suite` with the given `title` and `ctx`. Derived from [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
* Initialize a new `Suite` with the given `title`, `ctx` and `root`. Derived from [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
*
* @memberof Mocha
* @public
* @class
* @param {string} title
* @param {Context} parentContext
* @param {boolean} root
*/
function Suite(title, parentContext) {
function Suite(title, parentContext, root) {
if (!utils.isString(title)) {
throw createInvalidArgumentTypeError(
'Suite argument "title" must be a string. Received type "' +
Expand All @@ -70,7 +71,7 @@ function Suite(title, parentContext) {
this._beforeAll = [];
this._afterEach = [];
this._afterAll = [];
this.root = !title;
this.root = root || false;
this._timeout = 2000;
this._enableTimeouts = true;
this._slow = 75;
Expand Down

0 comments on commit c458e21

Please sign in to comment.