mocha 9.1.2 → 9.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/browser-entry.js +26 -16
  4. package/lib/browser/growl.js +5 -5
  5. package/lib/browser/parse-query.js +1 -1
  6. package/lib/browser/progress.js +6 -6
  7. package/lib/cli/config.js +7 -12
  8. package/lib/cli/run.js +1 -1
  9. package/lib/cli/watch-run.js +1 -4
  10. package/lib/context.js +5 -5
  11. package/lib/errors.js +1 -1
  12. package/lib/hook.js +2 -2
  13. package/lib/interfaces/bdd.js +23 -20
  14. package/lib/interfaces/common.js +7 -7
  15. package/lib/interfaces/exports.js +1 -1
  16. package/lib/interfaces/qunit.js +7 -7
  17. package/lib/interfaces/tdd.js +9 -9
  18. package/lib/mocha.js +56 -58
  19. package/lib/nodejs/buffered-worker-pool.js +17 -1
  20. package/lib/nodejs/esm-utils.js +18 -3
  21. package/lib/reporters/base.js +41 -28
  22. package/lib/reporters/doc.js +4 -4
  23. package/lib/reporters/dot.js +5 -5
  24. package/lib/reporters/html.js +12 -12
  25. package/lib/reporters/json-stream.js +4 -4
  26. package/lib/reporters/json.js +7 -7
  27. package/lib/reporters/landing.js +5 -5
  28. package/lib/reporters/list.js +5 -5
  29. package/lib/reporters/markdown.js +5 -5
  30. package/lib/reporters/min.js +1 -1
  31. package/lib/reporters/nyan.js +16 -16
  32. package/lib/reporters/progress.js +3 -3
  33. package/lib/reporters/spec.js +6 -6
  34. package/lib/reporters/tap.js +17 -17
  35. package/lib/reporters/xunit.js +9 -9
  36. package/lib/runnable.js +21 -21
  37. package/lib/runner.js +44 -47
  38. package/lib/stats-collector.js +7 -7
  39. package/lib/suite.js +44 -73
  40. package/lib/test.js +4 -4
  41. package/lib/utils.js +18 -19
  42. package/mocha-es2018.js +432 -449
  43. package/mocha.js +1246 -851
  44. package/mocha.js.map +1 -1
  45. package/package.json +38 -38
  46. package/CHANGELOG.md +0 -1015
@@ -74,19 +74,19 @@ function XUnit(runner, options) {
74
74
  // fall back to the default suite name
75
75
  suiteName = suiteName || DEFAULT_SUITE_NAME;
76
76
 
77
- runner.on(EVENT_TEST_PENDING, function(test) {
77
+ runner.on(EVENT_TEST_PENDING, function (test) {
78
78
  tests.push(test);
79
79
  });
80
80
 
81
- runner.on(EVENT_TEST_PASS, function(test) {
81
+ runner.on(EVENT_TEST_PASS, function (test) {
82
82
  tests.push(test);
83
83
  });
84
84
 
85
- runner.on(EVENT_TEST_FAIL, function(test) {
85
+ runner.on(EVENT_TEST_FAIL, function (test) {
86
86
  tests.push(test);
87
87
  });
88
88
 
89
- runner.once(EVENT_RUN_END, function() {
89
+ runner.once(EVENT_RUN_END, function () {
90
90
  self.write(
91
91
  tag(
92
92
  'testsuite',
@@ -103,7 +103,7 @@ function XUnit(runner, options) {
103
103
  )
104
104
  );
105
105
 
106
- tests.forEach(function(t) {
106
+ tests.forEach(function (t) {
107
107
  self.test(t);
108
108
  });
109
109
 
@@ -122,9 +122,9 @@ inherits(XUnit, Base);
122
122
  * @param failures
123
123
  * @param {Function} fn
124
124
  */
125
- XUnit.prototype.done = function(failures, fn) {
125
+ XUnit.prototype.done = function (failures, fn) {
126
126
  if (this.fileStream) {
127
- this.fileStream.end(function() {
127
+ this.fileStream.end(function () {
128
128
  fn(failures);
129
129
  });
130
130
  } else {
@@ -137,7 +137,7 @@ XUnit.prototype.done = function(failures, fn) {
137
137
  *
138
138
  * @param {string} line
139
139
  */
140
- XUnit.prototype.write = function(line) {
140
+ XUnit.prototype.write = function (line) {
141
141
  if (this.fileStream) {
142
142
  this.fileStream.write(line + '\n');
143
143
  } else if (typeof process === 'object' && process.stdout) {
@@ -152,7 +152,7 @@ XUnit.prototype.write = function(line) {
152
152
  *
153
153
  * @param {Test} test
154
154
  */
155
- XUnit.prototype.test = function(test) {
155
+ XUnit.prototype.test = function (test) {
156
156
  Base.useColors = false;
157
157
 
158
158
  var attrs = {
package/lib/runnable.js CHANGED
@@ -57,7 +57,7 @@ utils.inherits(Runnable, EventEmitter);
57
57
  /**
58
58
  * Resets the state initially or for a next run.
59
59
  */
60
- Runnable.prototype.reset = function() {
60
+ Runnable.prototype.reset = function () {
61
61
  this.timedOut = false;
62
62
  this._currentRetry = 0;
63
63
  this.pending = false;
@@ -86,7 +86,7 @@ Runnable.prototype.reset = function() {
86
86
  * @returns {Runnable} this
87
87
  * @chainable
88
88
  */
89
- Runnable.prototype.timeout = function(ms) {
89
+ Runnable.prototype.timeout = function (ms) {
90
90
  if (!arguments.length) {
91
91
  return this._timeout;
92
92
  }
@@ -120,7 +120,7 @@ Runnable.prototype.timeout = function(ms) {
120
120
  * @param {number|string} ms
121
121
  * @return {Runnable|number} ms or Runnable instance.
122
122
  */
123
- Runnable.prototype.slow = function(ms) {
123
+ Runnable.prototype.slow = function (ms) {
124
124
  if (!arguments.length || typeof ms === 'undefined') {
125
125
  return this._slow;
126
126
  }
@@ -138,7 +138,7 @@ Runnable.prototype.slow = function(ms) {
138
138
  * @memberof Mocha.Runnable
139
139
  * @public
140
140
  */
141
- Runnable.prototype.skip = function() {
141
+ Runnable.prototype.skip = function () {
142
142
  this.pending = true;
143
143
  throw new Pending('sync skip; aborting execution');
144
144
  };
@@ -148,7 +148,7 @@ Runnable.prototype.skip = function() {
148
148
  *
149
149
  * @private
150
150
  */
151
- Runnable.prototype.isPending = function() {
151
+ Runnable.prototype.isPending = function () {
152
152
  return this.pending || (this.parent && this.parent.isPending());
153
153
  };
154
154
 
@@ -157,7 +157,7 @@ Runnable.prototype.isPending = function() {
157
157
  * @return {boolean}
158
158
  * @private
159
159
  */
160
- Runnable.prototype.isFailed = function() {
160
+ Runnable.prototype.isFailed = function () {
161
161
  return !this.isPending() && this.state === constants.STATE_FAILED;
162
162
  };
163
163
 
@@ -166,7 +166,7 @@ Runnable.prototype.isFailed = function() {
166
166
  * @return {boolean}
167
167
  * @private
168
168
  */
169
- Runnable.prototype.isPassed = function() {
169
+ Runnable.prototype.isPassed = function () {
170
170
  return !this.isPending() && this.state === constants.STATE_PASSED;
171
171
  };
172
172
 
@@ -175,7 +175,7 @@ Runnable.prototype.isPassed = function() {
175
175
  *
176
176
  * @private
177
177
  */
178
- Runnable.prototype.retries = function(n) {
178
+ Runnable.prototype.retries = function (n) {
179
179
  if (!arguments.length) {
180
180
  return this._retries;
181
181
  }
@@ -187,7 +187,7 @@ Runnable.prototype.retries = function(n) {
187
187
  *
188
188
  * @private
189
189
  */
190
- Runnable.prototype.currentRetry = function(n) {
190
+ Runnable.prototype.currentRetry = function (n) {
191
191
  if (!arguments.length) {
192
192
  return this._currentRetry;
193
193
  }
@@ -202,7 +202,7 @@ Runnable.prototype.currentRetry = function(n) {
202
202
  * @public
203
203
  * @return {string}
204
204
  */
205
- Runnable.prototype.fullTitle = function() {
205
+ Runnable.prototype.fullTitle = function () {
206
206
  return this.titlePath().join(' ');
207
207
  };
208
208
 
@@ -213,7 +213,7 @@ Runnable.prototype.fullTitle = function() {
213
213
  * @public
214
214
  * @return {string}
215
215
  */
216
- Runnable.prototype.titlePath = function() {
216
+ Runnable.prototype.titlePath = function () {
217
217
  return this.parent.titlePath().concat([this.title]);
218
218
  };
219
219
 
@@ -222,7 +222,7 @@ Runnable.prototype.titlePath = function() {
222
222
  *
223
223
  * @private
224
224
  */
225
- Runnable.prototype.clearTimeout = function() {
225
+ Runnable.prototype.clearTimeout = function () {
226
226
  clearTimeout(this.timer);
227
227
  };
228
228
 
@@ -231,7 +231,7 @@ Runnable.prototype.clearTimeout = function() {
231
231
  *
232
232
  * @private
233
233
  */
234
- Runnable.prototype.resetTimeout = function() {
234
+ Runnable.prototype.resetTimeout = function () {
235
235
  var self = this;
236
236
  var ms = this.timeout();
237
237
 
@@ -239,7 +239,7 @@ Runnable.prototype.resetTimeout = function() {
239
239
  return;
240
240
  }
241
241
  this.clearTimeout();
242
- this.timer = setTimeout(function() {
242
+ this.timer = setTimeout(function () {
243
243
  if (self.timeout() === 0) {
244
244
  return;
245
245
  }
@@ -254,7 +254,7 @@ Runnable.prototype.resetTimeout = function() {
254
254
  * @private
255
255
  * @param {string[]} globals
256
256
  */
257
- Runnable.prototype.globals = function(globals) {
257
+ Runnable.prototype.globals = function (globals) {
258
258
  if (!arguments.length) {
259
259
  return this._allowedGlobals;
260
260
  }
@@ -267,7 +267,7 @@ Runnable.prototype.globals = function(globals) {
267
267
  * @param {Function} fn
268
268
  * @private
269
269
  */
270
- Runnable.prototype.run = function(fn) {
270
+ Runnable.prototype.run = function (fn) {
271
271
  var self = this;
272
272
  var start = new Date();
273
273
  var ctx = this.ctx;
@@ -367,13 +367,13 @@ Runnable.prototype.run = function(fn) {
367
367
  if (result && typeof result.then === 'function') {
368
368
  self.resetTimeout();
369
369
  result.then(
370
- function() {
370
+ function () {
371
371
  done();
372
372
  // Return null so libraries like bluebird do not warn about
373
373
  // subsequently constructed Promises.
374
374
  return null;
375
375
  },
376
- function(reason) {
376
+ function (reason) {
377
377
  done(reason || new Error('Promise rejected with no or falsy reason'));
378
378
  }
379
379
  );
@@ -391,7 +391,7 @@ Runnable.prototype.run = function(fn) {
391
391
  }
392
392
 
393
393
  function callFnAsync(fn) {
394
- var result = fn.call(ctx, function(err) {
394
+ var result = fn.call(ctx, function (err) {
395
395
  if (err instanceof Error || toString.call(err) === '[object Error]') {
396
396
  return done(err);
397
397
  }
@@ -423,7 +423,7 @@ Runnable.prototype.run = function(fn) {
423
423
  * @returns {Error} a "timeout" error
424
424
  * @private
425
425
  */
426
- Runnable.prototype._timeoutError = function(ms) {
426
+ Runnable.prototype._timeoutError = function (ms) {
427
427
  let msg = `Timeout of ${ms}ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.`;
428
428
  if (this.file) {
429
429
  msg += ' (' + this.file + ')';
@@ -463,7 +463,7 @@ var constants = utils.defineConstants(
463
463
  * @returns {*|Error} `value`, otherwise an `Error`
464
464
  * @private
465
465
  */
466
- Runnable.toValueOrError = function(value) {
466
+ Runnable.toValueOrError = function (value) {
467
467
  return (
468
468
  value ||
469
469
  createInvalidExceptionError(
package/lib/runner.js CHANGED
@@ -139,7 +139,7 @@ class Runner extends EventEmitter {
139
139
  * @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
140
140
  * @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready.
141
141
  * @param {boolean} [opts.dryRun] - Whether to report tests without running them.
142
- * @param {boolean} [options.failZero] - Whether to fail test run if zero tests encountered.
142
+ * @param {boolean} [opts.failZero] - Whether to fail test run if zero tests encountered.
143
143
  */
144
144
  constructor(suite, opts) {
145
145
  super();
@@ -168,7 +168,7 @@ class Runner extends EventEmitter {
168
168
  * @type {Map<EventEmitter,Map<string,Set<EventListener>>>}
169
169
  */
170
170
  this._eventListeners = new Map();
171
- this.on(constants.EVENT_TEST_END, function(test) {
171
+ this.on(constants.EVENT_TEST_END, function (test) {
172
172
  if (test.type === 'test' && test.retriedTest() && test.parent) {
173
173
  var idx =
174
174
  test.parent.tests && test.parent.tests.indexOf(test.retriedTest());
@@ -176,7 +176,7 @@ class Runner extends EventEmitter {
176
176
  }
177
177
  self.checkGlobals(test);
178
178
  });
179
- this.on(constants.EVENT_HOOK_END, function(hook) {
179
+ this.on(constants.EVENT_HOOK_END, function (hook) {
180
180
  self.checkGlobals(hook);
181
181
  });
182
182
  this._defaultGrep = /.*/;
@@ -225,7 +225,7 @@ Runner.immediately = global.setImmediate || process.nextTick;
225
225
  * @param {string} fn - Listener function
226
226
  * @private
227
227
  */
228
- Runner.prototype._addEventListener = function(target, eventName, listener) {
228
+ Runner.prototype._addEventListener = function (target, eventName, listener) {
229
229
  debug(
230
230
  '_addEventListener(): adding for event %s; %d current listeners',
231
231
  eventName,
@@ -235,10 +235,7 @@ Runner.prototype._addEventListener = function(target, eventName, listener) {
235
235
  if (
236
236
  this._eventListeners.has(target) &&
237
237
  this._eventListeners.get(target).has(eventName) &&
238
- this._eventListeners
239
- .get(target)
240
- .get(eventName)
241
- .has(listener)
238
+ this._eventListeners.get(target).get(eventName).has(listener)
242
239
  ) {
243
240
  debug(
244
241
  'warning: tried to attach duplicate event listener for %s',
@@ -265,7 +262,7 @@ Runner.prototype._addEventListener = function(target, eventName, listener) {
265
262
  * @param {function} listener - Listener function
266
263
  * @private
267
264
  */
268
- Runner.prototype._removeEventListener = function(target, eventName, listener) {
265
+ Runner.prototype._removeEventListener = function (target, eventName, listener) {
269
266
  target.removeListener(eventName, listener);
270
267
 
271
268
  if (this._eventListeners.has(target)) {
@@ -289,7 +286,7 @@ Runner.prototype._removeEventListener = function(target, eventName, listener) {
289
286
  * Removes all event handlers set during a run on this instance.
290
287
  * Remark: this does _not_ clean/dispose the tests or suites themselves.
291
288
  */
292
- Runner.prototype.dispose = function() {
289
+ Runner.prototype.dispose = function () {
293
290
  this.removeAllListeners();
294
291
  this._eventListeners.forEach((targetListeners, target) => {
295
292
  targetListeners.forEach((targetEventListeners, eventName) => {
@@ -311,7 +308,7 @@ Runner.prototype.dispose = function() {
311
308
  * @param {boolean} invert
312
309
  * @return {Runner} Runner instance.
313
310
  */
314
- Runner.prototype.grep = function(re, invert) {
311
+ Runner.prototype.grep = function (re, invert) {
315
312
  debug('grep(): setting to %s', re);
316
313
  this._grep = re;
317
314
  this._invert = invert;
@@ -328,11 +325,11 @@ Runner.prototype.grep = function(re, invert) {
328
325
  * @param {Suite} suite
329
326
  * @return {number}
330
327
  */
331
- Runner.prototype.grepTotal = function(suite) {
328
+ Runner.prototype.grepTotal = function (suite) {
332
329
  var self = this;
333
330
  var total = 0;
334
331
 
335
- suite.eachTest(function(test) {
332
+ suite.eachTest(function (test) {
336
333
  var match = self._grep.test(test.fullTitle());
337
334
  if (self._invert) {
338
335
  match = !match;
@@ -351,7 +348,7 @@ Runner.prototype.grepTotal = function(suite) {
351
348
  * @return {Array}
352
349
  * @private
353
350
  */
354
- Runner.prototype.globalProps = function() {
351
+ Runner.prototype.globalProps = function () {
355
352
  var props = Object.keys(global);
356
353
 
357
354
  // non-enumerables
@@ -373,7 +370,7 @@ Runner.prototype.globalProps = function() {
373
370
  * @param {Array} arr
374
371
  * @return {Runner} Runner instance.
375
372
  */
376
- Runner.prototype.globals = function(arr) {
373
+ Runner.prototype.globals = function (arr) {
377
374
  if (!arguments.length) {
378
375
  return this._globals;
379
376
  }
@@ -387,7 +384,7 @@ Runner.prototype.globals = function(arr) {
387
384
  *
388
385
  * @private
389
386
  */
390
- Runner.prototype.checkGlobals = function(test) {
387
+ Runner.prototype.checkGlobals = function (test) {
391
388
  if (!this.checkLeaks) {
392
389
  return;
393
390
  }
@@ -435,7 +432,7 @@ Runner.prototype.checkGlobals = function(test) {
435
432
  * @param {Error} err
436
433
  * @param {boolean} [force=false] - Whether to fail a pending test.
437
434
  */
438
- Runner.prototype.fail = function(test, err, force) {
435
+ Runner.prototype.fail = function (test, err, force) {
439
436
  force = force === true;
440
437
  if (test.isPending() && !force) {
441
438
  return;
@@ -476,7 +473,7 @@ Runner.prototype.fail = function(test, err, force) {
476
473
  * @param {Function} fn
477
474
  */
478
475
 
479
- Runner.prototype.hook = function(name, fn) {
476
+ Runner.prototype.hook = function (name, fn) {
480
477
  if (this._opts.dryRun) return fn();
481
478
 
482
479
  var suite = this.suite;
@@ -505,7 +502,7 @@ Runner.prototype.hook = function(name, fn) {
505
502
  self.emit(constants.EVENT_HOOK_BEGIN, hook);
506
503
 
507
504
  if (!hook.listeners('error').length) {
508
- self._addEventListener(hook, 'error', function(err) {
505
+ self._addEventListener(hook, 'error', function (err) {
509
506
  self.fail(hook, err);
510
507
  });
511
508
  }
@@ -530,10 +527,10 @@ Runner.prototype.hook = function(name, fn) {
530
527
  hook.pending = false; // activates hook for next test
531
528
  return fn(new Error('abort hookDown'));
532
529
  } else if (name === HOOK_TYPE_BEFORE_ALL) {
533
- suite.tests.forEach(function(test) {
530
+ suite.tests.forEach(function (test) {
534
531
  test.pending = true;
535
532
  });
536
- suite.suites.forEach(function(suite) {
533
+ suite.suites.forEach(function (suite) {
537
534
  suite.pending = true;
538
535
  });
539
536
  hooks = [];
@@ -570,7 +567,7 @@ Runner.prototype.hook = function(name, fn) {
570
567
  }
571
568
  }
572
569
 
573
- Runner.immediately(function() {
570
+ Runner.immediately(function () {
574
571
  next(0);
575
572
  });
576
573
  };
@@ -584,7 +581,7 @@ Runner.prototype.hook = function(name, fn) {
584
581
  * @param {Array} suites
585
582
  * @param {Function} fn
586
583
  */
587
- Runner.prototype.hooks = function(name, suites, fn) {
584
+ Runner.prototype.hooks = function (name, suites, fn) {
588
585
  var self = this;
589
586
  var orig = this.suite;
590
587
 
@@ -596,7 +593,7 @@ Runner.prototype.hooks = function(name, suites, fn) {
596
593
  return fn();
597
594
  }
598
595
 
599
- self.hook(name, function(err) {
596
+ self.hook(name, function (err) {
600
597
  if (err) {
601
598
  var errSuite = self.suite;
602
599
  self.suite = orig;
@@ -617,7 +614,7 @@ Runner.prototype.hooks = function(name, suites, fn) {
617
614
  * @param {Function} fn
618
615
  * @private
619
616
  */
620
- Runner.prototype.hookUp = function(name, fn) {
617
+ Runner.prototype.hookUp = function (name, fn) {
621
618
  var suites = [this.suite].concat(this.parents()).reverse();
622
619
  this.hooks(name, suites, fn);
623
620
  };
@@ -629,7 +626,7 @@ Runner.prototype.hookUp = function(name, fn) {
629
626
  * @param {Function} fn
630
627
  * @private
631
628
  */
632
- Runner.prototype.hookDown = function(name, fn) {
629
+ Runner.prototype.hookDown = function (name, fn) {
633
630
  var suites = [this.suite].concat(this.parents());
634
631
  this.hooks(name, suites, fn);
635
632
  };
@@ -641,7 +638,7 @@ Runner.prototype.hookDown = function(name, fn) {
641
638
  * @return {Array}
642
639
  * @private
643
640
  */
644
- Runner.prototype.parents = function() {
641
+ Runner.prototype.parents = function () {
645
642
  var suite = this.suite;
646
643
  var suites = [];
647
644
  while (suite.parent) {
@@ -657,7 +654,7 @@ Runner.prototype.parents = function() {
657
654
  * @param {Function} fn
658
655
  * @private
659
656
  */
660
- Runner.prototype.runTest = function(fn) {
657
+ Runner.prototype.runTest = function (fn) {
661
658
  if (this._opts.dryRun) return fn();
662
659
 
663
660
  var self = this;
@@ -670,7 +667,7 @@ Runner.prototype.runTest = function(fn) {
670
667
  if (this.asyncOnly) {
671
668
  test.asyncOnly = true;
672
669
  }
673
- this._addEventListener(test, 'error', function(err) {
670
+ this._addEventListener(test, 'error', function (err) {
674
671
  self.fail(test, err);
675
672
  });
676
673
  if (this.allowUncaught) {
@@ -691,7 +688,7 @@ Runner.prototype.runTest = function(fn) {
691
688
  * @param {Suite} suite
692
689
  * @param {Function} fn
693
690
  */
694
- Runner.prototype.runTests = function(suite, fn) {
691
+ Runner.prototype.runTests = function (suite, fn) {
695
692
  var self = this;
696
693
  var tests = suite.tests.slice();
697
694
  var test;
@@ -705,7 +702,7 @@ Runner.prototype.runTests = function(suite, fn) {
705
702
  self.suite = after ? errSuite.parent : errSuite;
706
703
 
707
704
  if (self.suite) {
708
- self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
705
+ self.hookUp(HOOK_TYPE_AFTER_EACH, function (err2, errSuite2) {
709
706
  self.suite = orig;
710
707
  // some hooks may fail even now
711
708
  if (err2) {
@@ -779,7 +776,7 @@ Runner.prototype.runTests = function(suite, fn) {
779
776
 
780
777
  // execute test and hook(s)
781
778
  self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
782
- self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
779
+ self.hookDown(HOOK_TYPE_BEFORE_EACH, function (err, errSuite) {
783
780
  // conditional skip within beforeEach
784
781
  if (test.isPending()) {
785
782
  if (self.forbidPending) {
@@ -792,7 +789,7 @@ Runner.prototype.runTests = function(suite, fn) {
792
789
  // skip inner afterEach hooks below errSuite level
793
790
  var origSuite = self.suite;
794
791
  self.suite = errSuite || self.suite;
795
- return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
792
+ return self.hookUp(HOOK_TYPE_AFTER_EACH, function (e, eSuite) {
796
793
  self.suite = origSuite;
797
794
  next(e, eSuite);
798
795
  });
@@ -801,7 +798,7 @@ Runner.prototype.runTests = function(suite, fn) {
801
798
  return hookErr(err, errSuite, false);
802
799
  }
803
800
  self.currentRunnable = self.test;
804
- self.runTest(function(err) {
801
+ self.runTest(function (err) {
805
802
  test = self.test;
806
803
  // conditional skip within it
807
804
  if (test.pending) {
@@ -852,7 +849,7 @@ Runner.prototype.runTests = function(suite, fn) {
852
849
  * @param {Suite} suite
853
850
  * @param {Function} fn
854
851
  */
855
- Runner.prototype.runSuite = function(suite, fn) {
852
+ Runner.prototype.runSuite = function (suite, fn) {
856
853
  var i = 0;
857
854
  var self = this;
858
855
  var total = this.grepTotal(suite);
@@ -892,7 +889,7 @@ Runner.prototype.runSuite = function(suite, fn) {
892
889
  // huge recursive loop and thus a maximum call stack error.
893
890
  // See comment in `this.runTests()` for more information.
894
891
  if (self._grep !== self._defaultGrep) {
895
- Runner.immediately(function() {
892
+ Runner.immediately(function () {
896
893
  self.runSuite(curr, next);
897
894
  });
898
895
  } else {
@@ -907,7 +904,7 @@ Runner.prototype.runSuite = function(suite, fn) {
907
904
  // remove reference to test
908
905
  delete self.test;
909
906
 
910
- self.hook(HOOK_TYPE_AFTER_ALL, function() {
907
+ self.hook(HOOK_TYPE_AFTER_ALL, function () {
911
908
  self.emit(constants.EVENT_SUITE_END, suite);
912
909
  fn(errSuite);
913
910
  });
@@ -915,7 +912,7 @@ Runner.prototype.runSuite = function(suite, fn) {
915
912
 
916
913
  this.nextSuite = next;
917
914
 
918
- this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
915
+ this.hook(HOOK_TYPE_BEFORE_ALL, function (err) {
919
916
  if (err) {
920
917
  return done();
921
918
  }
@@ -939,7 +936,7 @@ Runner.prototype.runSuite = function(suite, fn) {
939
936
  * @param {Error} err - Some uncaught error
940
937
  * @private
941
938
  */
942
- Runner.prototype._uncaught = function(err) {
939
+ Runner.prototype._uncaught = function (err) {
943
940
  // this is defensive to prevent future developers from mis-calling this function.
944
941
  // it's more likely that it'd be called with the incorrect context--say, the global
945
942
  // `process` object--than it would to be called with a context that is not a "subclass"
@@ -1037,12 +1034,12 @@ Runner.prototype._uncaught = function(err) {
1037
1034
  * @param {{files: string[], options: Options}} [opts] - For subclasses
1038
1035
  * @returns {Runner} Runner instance.
1039
1036
  */
1040
- Runner.prototype.run = function(fn, opts = {}) {
1037
+ Runner.prototype.run = function (fn, opts = {}) {
1041
1038
  var rootSuite = this.suite;
1042
1039
  var options = opts.options || {};
1043
1040
 
1044
1041
  debug('run(): got options: %O', options);
1045
- fn = fn || function() {};
1042
+ fn = fn || function () {};
1046
1043
 
1047
1044
  const end = () => {
1048
1045
  if (!this.total && this._opts.failZero) this.failures = 1;
@@ -1083,7 +1080,7 @@ Runner.prototype.run = function(fn, opts = {}) {
1083
1080
  }
1084
1081
 
1085
1082
  // callback
1086
- this.on(constants.EVENT_RUN_END, function() {
1083
+ this.on(constants.EVENT_RUN_END, function () {
1087
1084
  this.state = constants.STATE_STOPPED;
1088
1085
  debug('run(): emitted %s', constants.EVENT_RUN_END);
1089
1086
  fn(this.failures);
@@ -1130,7 +1127,7 @@ Runner.prototype.run = function(fn, opts = {}) {
1130
1127
  * }
1131
1128
  * }
1132
1129
  */
1133
- Runner.prototype.linkPartialObjects = function(value) {
1130
+ Runner.prototype.linkPartialObjects = function (value) {
1134
1131
  return this;
1135
1132
  };
1136
1133
 
@@ -1155,7 +1152,7 @@ Runner.prototype.runAsync = async function runAsync(opts = {}) {
1155
1152
  * @public
1156
1153
  * @return {Runner} Runner instance.
1157
1154
  */
1158
- Runner.prototype.abort = function() {
1155
+ Runner.prototype.abort = function () {
1159
1156
  debug('abort(): aborting');
1160
1157
  this._abort = true;
1161
1158
 
@@ -1183,7 +1180,7 @@ Runner.prototype.isParallelMode = function isParallelMode() {
1183
1180
  * @chainable
1184
1181
  * @abstract
1185
1182
  */
1186
- Runner.prototype.workerReporter = function() {
1183
+ Runner.prototype.workerReporter = function () {
1187
1184
  throw createUnsupportedError('workerReporter() not supported in serial mode');
1188
1185
  };
1189
1186
 
@@ -1196,7 +1193,7 @@ Runner.prototype.workerReporter = function() {
1196
1193
  * @return {Array}
1197
1194
  */
1198
1195
  function filterLeaks(ok, globals) {
1199
- return globals.filter(function(key) {
1196
+ return globals.filter(function (key) {
1200
1197
  // Firefox and Chrome exposes iframes as index inside the window object
1201
1198
  if (/^\d+/.test(key)) {
1202
1199
  return false;
@@ -1220,7 +1217,7 @@ function filterLeaks(ok, globals) {
1220
1217
  return false;
1221
1218
  }
1222
1219
 
1223
- var matched = ok.filter(function(ok) {
1220
+ var matched = ok.filter(function (ok) {
1224
1221
  if (~ok.indexOf('*')) {
1225
1222
  return key.indexOf(ok.split('*')[0]) === 0;
1226
1223
  }
@@ -56,25 +56,25 @@ function createStatsCollector(runner) {
56
56
 
57
57
  runner.stats = stats;
58
58
 
59
- runner.once(EVENT_RUN_BEGIN, function() {
59
+ runner.once(EVENT_RUN_BEGIN, function () {
60
60
  stats.start = new Date();
61
61
  });
62
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
62
+ runner.on(EVENT_SUITE_BEGIN, function (suite) {
63
63
  suite.root || stats.suites++;
64
64
  });
65
- runner.on(EVENT_TEST_PASS, function() {
65
+ runner.on(EVENT_TEST_PASS, function () {
66
66
  stats.passes++;
67
67
  });
68
- runner.on(EVENT_TEST_FAIL, function() {
68
+ runner.on(EVENT_TEST_FAIL, function () {
69
69
  stats.failures++;
70
70
  });
71
- runner.on(EVENT_TEST_PENDING, function() {
71
+ runner.on(EVENT_TEST_PENDING, function () {
72
72
  stats.pending++;
73
73
  });
74
- runner.on(EVENT_TEST_END, function() {
74
+ runner.on(EVENT_TEST_END, function () {
75
75
  stats.tests++;
76
76
  });
77
- runner.once(EVENT_RUN_END, function() {
77
+ runner.once(EVENT_RUN_END, function () {
78
78
  stats.end = new Date();
79
79
  stats.duration = stats.end - stats.start;
80
80
  });