mocha 9.1.0 → 9.1.4

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 +27 -20
  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/one-and-dones.js +1 -2
  8. package/lib/cli/run-helpers.js +1 -1
  9. package/lib/cli/run.js +1 -1
  10. package/lib/cli/watch-run.js +3 -6
  11. package/lib/context.js +5 -5
  12. package/lib/errors.js +1 -1
  13. package/lib/hook.js +9 -3
  14. package/lib/interfaces/bdd.js +23 -20
  15. package/lib/interfaces/common.js +7 -7
  16. package/lib/interfaces/exports.js +1 -1
  17. package/lib/interfaces/qunit.js +7 -7
  18. package/lib/interfaces/tdd.js +9 -9
  19. package/lib/mocha.js +57 -67
  20. package/lib/{esm-utils.js → nodejs/esm-utils.js} +18 -3
  21. package/lib/reporters/base.js +18 -21
  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 +46 -75
  40. package/lib/test.js +5 -5
  41. package/lib/utils.js +19 -46
  42. package/mocha-es2018.js +443 -486
  43. package/mocha.js +1457 -1032
  44. package/mocha.js.map +1 -1
  45. package/package.json +39 -40
  46. package/CHANGELOG.md +0 -998
package/mocha-es2018.js CHANGED
@@ -1,9 +1,9 @@
1
- // mocha@9.1.0 in javascript ES2018
1
+ // mocha@9.1.4 in javascript ES2018
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mocha = factory());
6
- }(this, (function () { 'use strict';
6
+ })(this, (function () { 'use strict';
7
7
 
8
8
  var global$2 = (typeof global$1 !== "undefined" ? global$1 :
9
9
  typeof self !== "undefined" ? self :
@@ -7383,7 +7383,7 @@
7383
7383
  return qs
7384
7384
  .replace('?', '')
7385
7385
  .split('&')
7386
- .reduce(function(obj, pair) {
7386
+ .reduce(function (obj, pair) {
7387
7387
  var i = pair.indexOf('=');
7388
7388
  var key = pair.slice(0, i);
7389
7389
  var val = pair.slice(++i);
@@ -9835,7 +9835,7 @@
9835
9835
  * @param {string} html
9836
9836
  * @return {string}
9837
9837
  */
9838
- exports.escape = function(html) {
9838
+ exports.escape = function (html) {
9839
9839
  return he.encode(String(html), {useNamedReferences: false});
9840
9840
  };
9841
9841
 
@@ -9846,7 +9846,7 @@
9846
9846
  * @param {Object} obj
9847
9847
  * @return {boolean}
9848
9848
  */
9849
- exports.isString = function(obj) {
9849
+ exports.isString = function (obj) {
9850
9850
  return typeof obj === 'string';
9851
9851
  };
9852
9852
 
@@ -9857,7 +9857,7 @@
9857
9857
  * @param {string} str
9858
9858
  * @return {string}
9859
9859
  */
9860
- exports.slug = function(str) {
9860
+ exports.slug = function (str) {
9861
9861
  return str
9862
9862
  .toLowerCase()
9863
9863
  .replace(/\s+/g, '-')
@@ -9871,7 +9871,7 @@
9871
9871
  * @param {string} str
9872
9872
  * @return {string}
9873
9873
  */
9874
- exports.clean = function(str) {
9874
+ exports.clean = function (str) {
9875
9875
  str = str
9876
9876
  .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
9877
9877
  .replace(/^\uFEFF/, '')
@@ -10013,7 +10013,7 @@
10013
10013
  * @param {*} value
10014
10014
  * @return {string}
10015
10015
  */
10016
- exports.stringify = function(value) {
10016
+ exports.stringify = function (value) {
10017
10017
  var typeHint = canonicalType(value);
10018
10018
 
10019
10019
  if (!~['object', 'array', 'function'].indexOf(typeHint)) {
@@ -10029,7 +10029,7 @@
10029
10029
  // IE7/IE8 has a bizarre String constructor; needs to be coerced
10030
10030
  // into an array and back to obj.
10031
10031
  if (typeHint === 'string' && typeof value === 'object') {
10032
- value = value.split('').reduce(function(acc, char, idx) {
10032
+ value = value.split('').reduce(function (acc, char, idx) {
10033
10033
  acc[idx] = char;
10034
10034
  return acc;
10035
10035
  }, {});
@@ -10184,14 +10184,14 @@
10184
10184
  canonicalizedObj = value;
10185
10185
  break;
10186
10186
  case 'array':
10187
- withStack(value, function() {
10188
- canonicalizedObj = value.map(function(item) {
10187
+ withStack(value, function () {
10188
+ canonicalizedObj = value.map(function (item) {
10189
10189
  return exports.canonicalize(item, stack);
10190
10190
  });
10191
10191
  });
10192
10192
  break;
10193
10193
  case 'function':
10194
- /* eslint-disable-next-line no-unused-vars */
10194
+ /* eslint-disable-next-line no-unused-vars, no-unreachable-loop */
10195
10195
  for (prop in value) {
10196
10196
  canonicalizedObj = {};
10197
10197
  break;
@@ -10204,10 +10204,10 @@
10204
10204
  /* falls through */
10205
10205
  case 'object':
10206
10206
  canonicalizedObj = canonicalizedObj || {};
10207
- withStack(value, function() {
10207
+ withStack(value, function () {
10208
10208
  Object.keys(value)
10209
10209
  .sort()
10210
- .forEach(function(key) {
10210
+ .forEach(function (key) {
10211
10211
  canonicalizedObj[key] = exports.canonicalize(value[key], stack);
10212
10212
  });
10213
10213
  });
@@ -10235,7 +10235,7 @@
10235
10235
  * (i.e: strip Mocha and internal node functions from stack trace).
10236
10236
  * @returns {Function}
10237
10237
  */
10238
- exports.stackTraceFilter = function() {
10238
+ exports.stackTraceFilter = function () {
10239
10239
  // TODO: Replace with `process.browser`
10240
10240
  var is = typeof document === 'undefined' ? {node: true} : {browser: true};
10241
10241
  var slash = path.sep;
@@ -10243,9 +10243,8 @@
10243
10243
  if (is.node) {
10244
10244
  cwd = exports.cwd() + slash;
10245
10245
  } else {
10246
- cwd = (typeof location === 'undefined'
10247
- ? window.location
10248
- : location
10246
+ cwd = (
10247
+ typeof location === 'undefined' ? window.location : location
10249
10248
  ).href.replace(/\/[^/]*$/, '/');
10250
10249
  slash = '/';
10251
10250
  }
@@ -10269,10 +10268,10 @@
10269
10268
  );
10270
10269
  }
10271
10270
 
10272
- return function(stack) {
10271
+ return function (stack) {
10273
10272
  stack = stack.split('\n');
10274
10273
 
10275
- stack = stack.reduce(function(list, line) {
10274
+ stack = stack.reduce(function (list, line) {
10276
10275
  if (isMochaInternal(line)) {
10277
10276
  return list;
10278
10277
  }
@@ -10323,7 +10322,7 @@
10323
10322
  * It's a noop.
10324
10323
  * @public
10325
10324
  */
10326
- exports.noop = function() {};
10325
+ exports.noop = function () {};
10327
10326
 
10328
10327
  /**
10329
10328
  * Creates a map-like object.
@@ -10340,7 +10339,7 @@
10340
10339
  * @param {...*} [obj] - Arguments to `Object.assign()`.
10341
10340
  * @returns {Object} An object with no prototype, having `...obj` properties
10342
10341
  */
10343
- exports.createMap = function(obj) {
10342
+ exports.createMap = function (obj) {
10344
10343
  return Object.assign.apply(
10345
10344
  null,
10346
10345
  [Object.create(null)].concat(Array.prototype.slice.call(arguments))
@@ -10359,39 +10358,13 @@
10359
10358
  * @returns {Object} A frozen object with no prototype, having `...obj` properties
10360
10359
  * @throws {TypeError} if argument is not a non-empty object.
10361
10360
  */
10362
- exports.defineConstants = function(obj) {
10361
+ exports.defineConstants = function (obj) {
10363
10362
  if (canonicalType(obj) !== 'object' || !Object.keys(obj).length) {
10364
10363
  throw new TypeError('Invalid argument; expected a non-empty object');
10365
10364
  }
10366
10365
  return Object.freeze(exports.createMap(obj));
10367
10366
  };
10368
10367
 
10369
- /**
10370
- * Whether current version of Node support ES modules
10371
- *
10372
- * @description
10373
- * Versions prior to 10 did not support ES Modules, and version 10 has an old incompatible version of ESM.
10374
- * This function returns whether Node.JS has ES Module supports that is compatible with Mocha's needs,
10375
- * which is version >=12.11.
10376
- *
10377
- * @param {partialSupport} whether the full Node.js ESM support is available (>= 12) or just something that supports the runtime (>= 10)
10378
- *
10379
- * @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha
10380
- */
10381
- exports.supportsEsModules = function(partialSupport) {
10382
- if (!exports.isBrowser() && process$1.versions && process$1.versions.node) {
10383
- var versionFields = process$1.versions.node.split('.');
10384
- var major = +versionFields[0];
10385
- var minor = +versionFields[1];
10386
-
10387
- if (!partialSupport) {
10388
- return major >= 13 || (major === 12 && minor >= 11);
10389
- } else {
10390
- return major >= 10;
10391
- }
10392
- }
10393
- };
10394
-
10395
10368
  /**
10396
10369
  * Returns current working directory
10397
10370
  *
@@ -10721,6 +10694,8 @@
10721
10694
  function createDebug(namespace) {
10722
10695
  let prevTime;
10723
10696
  let enableOverride = null;
10697
+ let namespacesCache;
10698
+ let enabledCache;
10724
10699
 
10725
10700
  function debug(...args) {
10726
10701
  // Disabled?
@@ -10781,7 +10756,17 @@
10781
10756
  Object.defineProperty(debug, 'enabled', {
10782
10757
  enumerable: true,
10783
10758
  configurable: false,
10784
- get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
10759
+ get: () => {
10760
+ if (enableOverride !== null) {
10761
+ return enableOverride;
10762
+ }
10763
+ if (namespacesCache !== createDebug.namespaces) {
10764
+ namespacesCache = createDebug.namespaces;
10765
+ enabledCache = createDebug.enabled(namespace);
10766
+ }
10767
+
10768
+ return enabledCache;
10769
+ },
10785
10770
  set: v => {
10786
10771
  enableOverride = v;
10787
10772
  }
@@ -10810,6 +10795,7 @@
10810
10795
  */
10811
10796
  function enable(namespaces) {
10812
10797
  createDebug.save(namespaces);
10798
+ createDebug.namespaces = namespaces;
10813
10799
 
10814
10800
  createDebug.names = [];
10815
10801
  createDebug.skips = [];
@@ -11211,7 +11197,7 @@
11211
11197
  process$1.emitWarning(msg, type);
11212
11198
  } else {
11213
11199
  /* istanbul ignore next */
11214
- nextTick$1(function() {
11200
+ nextTick$1(function () {
11215
11201
  console.warn(type + ': ' + msg);
11216
11202
  });
11217
11203
  }
@@ -11803,7 +11789,7 @@
11803
11789
  /**
11804
11790
  * Resets the state initially or for a next run.
11805
11791
  */
11806
- Runnable.prototype.reset = function() {
11792
+ Runnable.prototype.reset = function () {
11807
11793
  this.timedOut = false;
11808
11794
  this._currentRetry = 0;
11809
11795
  this.pending = false;
@@ -11832,7 +11818,7 @@
11832
11818
  * @returns {Runnable} this
11833
11819
  * @chainable
11834
11820
  */
11835
- Runnable.prototype.timeout = function(ms) {
11821
+ Runnable.prototype.timeout = function (ms) {
11836
11822
  if (!arguments.length) {
11837
11823
  return this._timeout;
11838
11824
  }
@@ -11866,7 +11852,7 @@
11866
11852
  * @param {number|string} ms
11867
11853
  * @return {Runnable|number} ms or Runnable instance.
11868
11854
  */
11869
- Runnable.prototype.slow = function(ms) {
11855
+ Runnable.prototype.slow = function (ms) {
11870
11856
  if (!arguments.length || typeof ms === 'undefined') {
11871
11857
  return this._slow;
11872
11858
  }
@@ -11884,7 +11870,7 @@
11884
11870
  * @memberof Mocha.Runnable
11885
11871
  * @public
11886
11872
  */
11887
- Runnable.prototype.skip = function() {
11873
+ Runnable.prototype.skip = function () {
11888
11874
  this.pending = true;
11889
11875
  throw new pending('sync skip; aborting execution');
11890
11876
  };
@@ -11894,7 +11880,7 @@
11894
11880
  *
11895
11881
  * @private
11896
11882
  */
11897
- Runnable.prototype.isPending = function() {
11883
+ Runnable.prototype.isPending = function () {
11898
11884
  return this.pending || (this.parent && this.parent.isPending());
11899
11885
  };
11900
11886
 
@@ -11903,7 +11889,7 @@
11903
11889
  * @return {boolean}
11904
11890
  * @private
11905
11891
  */
11906
- Runnable.prototype.isFailed = function() {
11892
+ Runnable.prototype.isFailed = function () {
11907
11893
  return !this.isPending() && this.state === constants$3.STATE_FAILED;
11908
11894
  };
11909
11895
 
@@ -11912,7 +11898,7 @@
11912
11898
  * @return {boolean}
11913
11899
  * @private
11914
11900
  */
11915
- Runnable.prototype.isPassed = function() {
11901
+ Runnable.prototype.isPassed = function () {
11916
11902
  return !this.isPending() && this.state === constants$3.STATE_PASSED;
11917
11903
  };
11918
11904
 
@@ -11921,7 +11907,7 @@
11921
11907
  *
11922
11908
  * @private
11923
11909
  */
11924
- Runnable.prototype.retries = function(n) {
11910
+ Runnable.prototype.retries = function (n) {
11925
11911
  if (!arguments.length) {
11926
11912
  return this._retries;
11927
11913
  }
@@ -11933,7 +11919,7 @@
11933
11919
  *
11934
11920
  * @private
11935
11921
  */
11936
- Runnable.prototype.currentRetry = function(n) {
11922
+ Runnable.prototype.currentRetry = function (n) {
11937
11923
  if (!arguments.length) {
11938
11924
  return this._currentRetry;
11939
11925
  }
@@ -11948,7 +11934,7 @@
11948
11934
  * @public
11949
11935
  * @return {string}
11950
11936
  */
11951
- Runnable.prototype.fullTitle = function() {
11937
+ Runnable.prototype.fullTitle = function () {
11952
11938
  return this.titlePath().join(' ');
11953
11939
  };
11954
11940
 
@@ -11959,7 +11945,7 @@
11959
11945
  * @public
11960
11946
  * @return {string}
11961
11947
  */
11962
- Runnable.prototype.titlePath = function() {
11948
+ Runnable.prototype.titlePath = function () {
11963
11949
  return this.parent.titlePath().concat([this.title]);
11964
11950
  };
11965
11951
 
@@ -11968,7 +11954,7 @@
11968
11954
  *
11969
11955
  * @private
11970
11956
  */
11971
- Runnable.prototype.clearTimeout = function() {
11957
+ Runnable.prototype.clearTimeout = function () {
11972
11958
  clearTimeout$1(this.timer);
11973
11959
  };
11974
11960
 
@@ -11977,7 +11963,7 @@
11977
11963
  *
11978
11964
  * @private
11979
11965
  */
11980
- Runnable.prototype.resetTimeout = function() {
11966
+ Runnable.prototype.resetTimeout = function () {
11981
11967
  var self = this;
11982
11968
  var ms = this.timeout();
11983
11969
 
@@ -11985,7 +11971,7 @@
11985
11971
  return;
11986
11972
  }
11987
11973
  this.clearTimeout();
11988
- this.timer = setTimeout$3(function() {
11974
+ this.timer = setTimeout$3(function () {
11989
11975
  if (self.timeout() === 0) {
11990
11976
  return;
11991
11977
  }
@@ -12000,7 +11986,7 @@
12000
11986
  * @private
12001
11987
  * @param {string[]} globals
12002
11988
  */
12003
- Runnable.prototype.globals = function(globals) {
11989
+ Runnable.prototype.globals = function (globals) {
12004
11990
  if (!arguments.length) {
12005
11991
  return this._allowedGlobals;
12006
11992
  }
@@ -12013,7 +11999,7 @@
12013
11999
  * @param {Function} fn
12014
12000
  * @private
12015
12001
  */
12016
- Runnable.prototype.run = function(fn) {
12002
+ Runnable.prototype.run = function (fn) {
12017
12003
  var self = this;
12018
12004
  var start = new Date$4();
12019
12005
  var ctx = this.ctx;
@@ -12113,13 +12099,13 @@
12113
12099
  if (result && typeof result.then === 'function') {
12114
12100
  self.resetTimeout();
12115
12101
  result.then(
12116
- function() {
12102
+ function () {
12117
12103
  done();
12118
12104
  // Return null so libraries like bluebird do not warn about
12119
12105
  // subsequently constructed Promises.
12120
12106
  return null;
12121
12107
  },
12122
- function(reason) {
12108
+ function (reason) {
12123
12109
  done(reason || new Error('Promise rejected with no or falsy reason'));
12124
12110
  }
12125
12111
  );
@@ -12137,7 +12123,7 @@
12137
12123
  }
12138
12124
 
12139
12125
  function callFnAsync(fn) {
12140
- var result = fn.call(ctx, function(err) {
12126
+ var result = fn.call(ctx, function (err) {
12141
12127
  if (err instanceof Error || toString.call(err) === '[object Error]') {
12142
12128
  return done(err);
12143
12129
  }
@@ -12169,7 +12155,7 @@
12169
12155
  * @returns {Error} a "timeout" error
12170
12156
  * @private
12171
12157
  */
12172
- Runnable.prototype._timeoutError = function(ms) {
12158
+ Runnable.prototype._timeoutError = function (ms) {
12173
12159
  let msg = `Timeout of ${ms}ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.`;
12174
12160
  if (this.file) {
12175
12161
  msg += ' (' + this.file + ')';
@@ -12209,7 +12195,7 @@
12209
12195
  * @returns {*|Error} `value`, otherwise an `Error`
12210
12196
  * @private
12211
12197
  */
12212
- Runnable.toValueOrError = function(value) {
12198
+ Runnable.toValueOrError = function (value) {
12213
12199
  return (
12214
12200
  value ||
12215
12201
  createInvalidExceptionError$1(
@@ -12251,7 +12237,7 @@
12251
12237
  /**
12252
12238
  * Resets the state for a next run.
12253
12239
  */
12254
- Hook.prototype.reset = function() {
12240
+ Hook.prototype.reset = function () {
12255
12241
  runnable.prototype.reset.call(this);
12256
12242
  delete this._error;
12257
12243
  };
@@ -12264,7 +12250,7 @@
12264
12250
  * @param {Error} err
12265
12251
  * @return {Error}
12266
12252
  */
12267
- Hook.prototype.error = function(err) {
12253
+ Hook.prototype.error = function (err) {
12268
12254
  if (!arguments.length) {
12269
12255
  err = this._error;
12270
12256
  this._error = null;
@@ -12282,7 +12268,9 @@
12282
12268
  */
12283
12269
  Hook.prototype.serialize = function serialize() {
12284
12270
  return {
12285
- $$isPending: this.isPending(),
12271
+ $$currentRetry: this.currentRetry(),
12272
+ $$fullTitle: this.fullTitle(),
12273
+ $$isPending: Boolean(this.isPending()),
12286
12274
  $$titlePath: this.titlePath(),
12287
12275
  ctx:
12288
12276
  this.ctx && this.ctx.currentTest
@@ -12293,9 +12281,13 @@
12293
12281
  }
12294
12282
  }
12295
12283
  : {},
12284
+ duration: this.duration,
12285
+ file: this.file,
12296
12286
  parent: {
12287
+ $$fullTitle: this.parent.fullTitle(),
12297
12288
  [MOCHA_ID_PROP_NAME$1]: this.parent.id
12298
12289
  },
12290
+ state: this.state,
12299
12291
  title: this.title,
12300
12292
  type: this.type,
12301
12293
  [MOCHA_ID_PROP_NAME$1]: this.id
@@ -12314,7 +12306,6 @@
12314
12306
  assignNewMochaID,
12315
12307
  clamp,
12316
12308
  constants: utilsConstants,
12317
- createMap,
12318
12309
  defineConstants,
12319
12310
  getMochaID,
12320
12311
  inherits,
@@ -12340,7 +12331,7 @@
12340
12331
  * @param {string} title - Title
12341
12332
  * @return {Suite}
12342
12333
  */
12343
- Suite.create = function(parent, title) {
12334
+ Suite.create = function (parent, title) {
12344
12335
  var suite = new Suite(title, parent.ctx);
12345
12336
  suite.parent = parent;
12346
12337
  title = suite.fullTitle();
@@ -12396,16 +12387,6 @@
12396
12387
  });
12397
12388
 
12398
12389
  this.reset();
12399
-
12400
- this.on('newListener', function(event) {
12401
- if (deprecatedEvents[event]) {
12402
- errors.deprecate(
12403
- 'Event "' +
12404
- event +
12405
- '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
12406
- );
12407
- }
12408
- });
12409
12390
  }
12410
12391
 
12411
12392
  /**
@@ -12416,7 +12397,7 @@
12416
12397
  /**
12417
12398
  * Resets the state initially or for a next run.
12418
12399
  */
12419
- Suite.prototype.reset = function() {
12400
+ Suite.prototype.reset = function () {
12420
12401
  this.delayed = false;
12421
12402
  function doReset(thingToReset) {
12422
12403
  thingToReset.reset();
@@ -12435,7 +12416,7 @@
12435
12416
  * @private
12436
12417
  * @return {Suite}
12437
12418
  */
12438
- Suite.prototype.clone = function() {
12419
+ Suite.prototype.clone = function () {
12439
12420
  var suite = new Suite(this.title);
12440
12421
  debug('clone');
12441
12422
  suite.ctx = this.ctx;
@@ -12455,7 +12436,7 @@
12455
12436
  * @param {number|string} ms
12456
12437
  * @return {Suite|number} for chaining
12457
12438
  */
12458
- Suite.prototype.timeout = function(ms) {
12439
+ Suite.prototype.timeout = function (ms) {
12459
12440
  if (!arguments.length) {
12460
12441
  return this._timeout;
12461
12442
  }
@@ -12480,7 +12461,7 @@
12480
12461
  * @param {number|string} n
12481
12462
  * @return {Suite|number} for chaining
12482
12463
  */
12483
- Suite.prototype.retries = function(n) {
12464
+ Suite.prototype.retries = function (n) {
12484
12465
  if (!arguments.length) {
12485
12466
  return this._retries;
12486
12467
  }
@@ -12496,7 +12477,7 @@
12496
12477
  * @param {number|string} ms
12497
12478
  * @return {Suite|number} for chaining
12498
12479
  */
12499
- Suite.prototype.slow = function(ms) {
12480
+ Suite.prototype.slow = function (ms) {
12500
12481
  if (!arguments.length) {
12501
12482
  return this._slow;
12502
12483
  }
@@ -12515,7 +12496,7 @@
12515
12496
  * @param {boolean} bail
12516
12497
  * @return {Suite|number} for chaining
12517
12498
  */
12518
- Suite.prototype.bail = function(bail) {
12499
+ Suite.prototype.bail = function (bail) {
12519
12500
  if (!arguments.length) {
12520
12501
  return this._bail;
12521
12502
  }
@@ -12529,7 +12510,7 @@
12529
12510
  *
12530
12511
  * @private
12531
12512
  */
12532
- Suite.prototype.isPending = function() {
12513
+ Suite.prototype.isPending = function () {
12533
12514
  return this.pending || (this.parent && this.parent.isPending());
12534
12515
  };
12535
12516
 
@@ -12540,7 +12521,7 @@
12540
12521
  * @param {Function} fn - Hook callback
12541
12522
  * @returns {Hook} A new hook
12542
12523
  */
12543
- Suite.prototype._createHook = function(title, fn) {
12524
+ Suite.prototype._createHook = function (title, fn) {
12544
12525
  var hook$1 = new hook(title, fn);
12545
12526
  hook$1.parent = this;
12546
12527
  hook$1.timeout(this.timeout());
@@ -12559,7 +12540,7 @@
12559
12540
  * @param {Function} fn
12560
12541
  * @return {Suite} for chaining
12561
12542
  */
12562
- Suite.prototype.beforeAll = function(title, fn) {
12543
+ Suite.prototype.beforeAll = function (title, fn) {
12563
12544
  if (this.isPending()) {
12564
12545
  return this;
12565
12546
  }
@@ -12583,7 +12564,7 @@
12583
12564
  * @param {Function} fn
12584
12565
  * @return {Suite} for chaining
12585
12566
  */
12586
- Suite.prototype.afterAll = function(title, fn) {
12567
+ Suite.prototype.afterAll = function (title, fn) {
12587
12568
  if (this.isPending()) {
12588
12569
  return this;
12589
12570
  }
@@ -12607,7 +12588,7 @@
12607
12588
  * @param {Function} fn
12608
12589
  * @return {Suite} for chaining
12609
12590
  */
12610
- Suite.prototype.beforeEach = function(title, fn) {
12591
+ Suite.prototype.beforeEach = function (title, fn) {
12611
12592
  if (this.isPending()) {
12612
12593
  return this;
12613
12594
  }
@@ -12631,7 +12612,7 @@
12631
12612
  * @param {Function} fn
12632
12613
  * @return {Suite} for chaining
12633
12614
  */
12634
- Suite.prototype.afterEach = function(title, fn) {
12615
+ Suite.prototype.afterEach = function (title, fn) {
12635
12616
  if (this.isPending()) {
12636
12617
  return this;
12637
12618
  }
@@ -12654,7 +12635,7 @@
12654
12635
  * @param {Suite} suite
12655
12636
  * @return {Suite} for chaining
12656
12637
  */
12657
- Suite.prototype.addSuite = function(suite) {
12638
+ Suite.prototype.addSuite = function (suite) {
12658
12639
  suite.parent = this;
12659
12640
  suite.root = false;
12660
12641
  suite.timeout(this.timeout());
@@ -12673,7 +12654,7 @@
12673
12654
  * @param {Test} test
12674
12655
  * @return {Suite} for chaining
12675
12656
  */
12676
- Suite.prototype.addTest = function(test) {
12657
+ Suite.prototype.addTest = function (test) {
12677
12658
  test.parent = this;
12678
12659
  test.timeout(this.timeout());
12679
12660
  test.retries(this.retries());
@@ -12692,7 +12673,7 @@
12692
12673
  * @public
12693
12674
  * @return {string}
12694
12675
  */
12695
- Suite.prototype.fullTitle = function() {
12676
+ Suite.prototype.fullTitle = function () {
12696
12677
  return this.titlePath().join(' ');
12697
12678
  };
12698
12679
 
@@ -12704,7 +12685,7 @@
12704
12685
  * @public
12705
12686
  * @return {string}
12706
12687
  */
12707
- Suite.prototype.titlePath = function() {
12688
+ Suite.prototype.titlePath = function () {
12708
12689
  var result = [];
12709
12690
  if (this.parent) {
12710
12691
  result = result.concat(this.parent.titlePath());
@@ -12722,9 +12703,9 @@
12722
12703
  * @public
12723
12704
  * @return {number}
12724
12705
  */
12725
- Suite.prototype.total = function() {
12706
+ Suite.prototype.total = function () {
12726
12707
  return (
12727
- this.suites.reduce(function(sum, suite) {
12708
+ this.suites.reduce(function (sum, suite) {
12728
12709
  return sum + suite.total();
12729
12710
  }, 0) + this.tests.length
12730
12711
  );
@@ -12738,9 +12719,9 @@
12738
12719
  * @param {Function} fn
12739
12720
  * @return {Suite}
12740
12721
  */
12741
- Suite.prototype.eachTest = function(fn) {
12722
+ Suite.prototype.eachTest = function (fn) {
12742
12723
  this.tests.forEach(fn);
12743
- this.suites.forEach(function(suite) {
12724
+ this.suites.forEach(function (suite) {
12744
12725
  suite.eachTest(fn);
12745
12726
  });
12746
12727
  return this;
@@ -12766,7 +12747,7 @@
12766
12747
  return (
12767
12748
  this._onlyTests.length > 0 ||
12768
12749
  this._onlySuites.length > 0 ||
12769
- this.suites.some(function(suite) {
12750
+ this.suites.some(function (suite) {
12770
12751
  return suite.hasOnly();
12771
12752
  })
12772
12753
  );
@@ -12786,7 +12767,7 @@
12786
12767
  } else {
12787
12768
  // Otherwise, do not run any of the tests in this suite.
12788
12769
  this.tests = [];
12789
- this._onlySuites.forEach(function(onlySuite) {
12770
+ this._onlySuites.forEach(function (onlySuite) {
12790
12771
  // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
12791
12772
  // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
12792
12773
  if (onlySuite.hasOnly()) {
@@ -12795,7 +12776,7 @@
12795
12776
  });
12796
12777
  // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
12797
12778
  var onlySuites = this._onlySuites;
12798
- this.suites = this.suites.filter(function(childSuite) {
12779
+ this.suites = this.suites.filter(function (childSuite) {
12799
12780
  return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
12800
12781
  });
12801
12782
  }
@@ -12809,7 +12790,7 @@
12809
12790
  * @private
12810
12791
  * @param {Suite} suite
12811
12792
  */
12812
- Suite.prototype.appendOnlySuite = function(suite) {
12793
+ Suite.prototype.appendOnlySuite = function (suite) {
12813
12794
  this._onlySuites.push(suite);
12814
12795
  };
12815
12796
 
@@ -12818,7 +12799,7 @@
12818
12799
  *
12819
12800
  * @private
12820
12801
  */
12821
- Suite.prototype.markOnly = function() {
12802
+ Suite.prototype.markOnly = function () {
12822
12803
  this.parent && this.parent.appendOnlySuite(this);
12823
12804
  };
12824
12805
 
@@ -12828,7 +12809,7 @@
12828
12809
  * @private
12829
12810
  * @param {Test} test
12830
12811
  */
12831
- Suite.prototype.appendOnlyTest = function(test) {
12812
+ Suite.prototype.appendOnlyTest = function (test) {
12832
12813
  this._onlyTests.push(test);
12833
12814
  };
12834
12815
 
@@ -12843,8 +12824,8 @@
12843
12824
  /**
12844
12825
  * cleans all references from this suite and all child suites.
12845
12826
  */
12846
- Suite.prototype.dispose = function() {
12847
- this.suites.forEach(function(suite) {
12827
+ Suite.prototype.dispose = function () {
12828
+ this.suites.forEach(function (suite) {
12848
12829
  suite.dispose();
12849
12830
  });
12850
12831
  this.cleanReferences();
@@ -12898,10 +12879,10 @@
12898
12879
  return {
12899
12880
  _bail: this._bail,
12900
12881
  $$fullTitle: this.fullTitle(),
12901
- $$isPending: this.isPending(),
12882
+ $$isPending: Boolean(this.isPending()),
12902
12883
  root: this.root,
12903
12884
  title: this.title,
12904
- id: this.id,
12885
+ [MOCHA_ID_PROP_NAME]: this.id,
12905
12886
  parent: this.parent ? {[MOCHA_ID_PROP_NAME]: this.parent.id} : null
12906
12887
  };
12907
12888
  };
@@ -12918,7 +12899,7 @@
12918
12899
  */
12919
12900
  {
12920
12901
  /**
12921
- * Event emitted after a test file has been loaded Not emitted in browser.
12902
+ * Event emitted after a test file has been loaded. Not emitted in browser.
12922
12903
  */
12923
12904
  EVENT_FILE_POST_REQUIRE: 'post-require',
12924
12905
  /**
@@ -12930,72 +12911,54 @@
12930
12911
  */
12931
12912
  EVENT_FILE_REQUIRE: 'require',
12932
12913
  /**
12933
- * Event emitted when `global.run()` is called (use with `delay` option)
12914
+ * Event emitted when `global.run()` is called (use with `delay` option).
12934
12915
  */
12935
12916
  EVENT_ROOT_SUITE_RUN: 'run',
12936
12917
 
12937
12918
  /**
12938
- * Namespace for collection of a `Suite`'s "after all" hooks
12919
+ * Namespace for collection of a `Suite`'s "after all" hooks.
12939
12920
  */
12940
12921
  HOOK_TYPE_AFTER_ALL: 'afterAll',
12941
12922
  /**
12942
- * Namespace for collection of a `Suite`'s "after each" hooks
12923
+ * Namespace for collection of a `Suite`'s "after each" hooks.
12943
12924
  */
12944
12925
  HOOK_TYPE_AFTER_EACH: 'afterEach',
12945
12926
  /**
12946
- * Namespace for collection of a `Suite`'s "before all" hooks
12927
+ * Namespace for collection of a `Suite`'s "before all" hooks.
12947
12928
  */
12948
12929
  HOOK_TYPE_BEFORE_ALL: 'beforeAll',
12949
12930
  /**
12950
- * Namespace for collection of a `Suite`'s "before all" hooks
12931
+ * Namespace for collection of a `Suite`'s "before each" hooks.
12951
12932
  */
12952
12933
  HOOK_TYPE_BEFORE_EACH: 'beforeEach',
12953
12934
 
12954
- // the following events are all deprecated
12955
-
12956
12935
  /**
12957
- * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
12936
+ * Emitted after a child `Suite` has been added to a `Suite`.
12937
+ */
12938
+ EVENT_SUITE_ADD_SUITE: 'suite',
12939
+ /**
12940
+ * Emitted after an "after all" `Hook` has been added to a `Suite`.
12958
12941
  */
12959
12942
  EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
12960
12943
  /**
12961
- * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
12944
+ * Emitted after an "after each" `Hook` has been added to a `Suite`.
12962
12945
  */
12963
12946
  EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
12964
12947
  /**
12965
- * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
12948
+ * Emitted after an "before all" `Hook` has been added to a `Suite`.
12966
12949
  */
12967
12950
  EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
12968
12951
  /**
12969
- * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
12952
+ * Emitted after an "before each" `Hook` has been added to a `Suite`.
12970
12953
  */
12971
12954
  EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
12972
12955
  /**
12973
- * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
12974
- */
12975
- EVENT_SUITE_ADD_SUITE: 'suite',
12976
- /**
12977
- * Emitted after a `Test` has been added to a `Suite`. Deprecated
12956
+ * Emitted after a `Test` has been added to a `Suite`.
12978
12957
  */
12979
12958
  EVENT_SUITE_ADD_TEST: 'test'
12980
12959
  }
12981
12960
  );
12982
12961
 
12983
- /**
12984
- * @summary There are no known use cases for these events.
12985
- * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
12986
- * @todo Remove eventually
12987
- * @type {Object<string,boolean>}
12988
- * @ignore
12989
- */
12990
- var deprecatedEvents = Object.keys(constants)
12991
- .filter(function(constant) {
12992
- return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
12993
- })
12994
- .reduce(function(acc, constant) {
12995
- acc[constants[constant]] = true;
12996
- return acc;
12997
- }, createMap());
12998
-
12999
12962
  Suite.constants = constants;
13000
12963
  });
13001
12964
 
@@ -13138,7 +13101,7 @@
13138
13101
  * @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
13139
13102
  * @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready.
13140
13103
  * @param {boolean} [opts.dryRun] - Whether to report tests without running them.
13141
- * @param {boolean} [options.failZero] - Whether to fail test run if zero tests encountered.
13104
+ * @param {boolean} [opts.failZero] - Whether to fail test run if zero tests encountered.
13142
13105
  */
13143
13106
  constructor(suite, opts) {
13144
13107
  super();
@@ -13167,7 +13130,7 @@
13167
13130
  * @type {Map<EventEmitter,Map<string,Set<EventListener>>>}
13168
13131
  */
13169
13132
  this._eventListeners = new Map();
13170
- this.on(constants$1.EVENT_TEST_END, function(test) {
13133
+ this.on(constants$1.EVENT_TEST_END, function (test) {
13171
13134
  if (test.type === 'test' && test.retriedTest() && test.parent) {
13172
13135
  var idx =
13173
13136
  test.parent.tests && test.parent.tests.indexOf(test.retriedTest());
@@ -13175,7 +13138,7 @@
13175
13138
  }
13176
13139
  self.checkGlobals(test);
13177
13140
  });
13178
- this.on(constants$1.EVENT_HOOK_END, function(hook) {
13141
+ this.on(constants$1.EVENT_HOOK_END, function (hook) {
13179
13142
  self.checkGlobals(hook);
13180
13143
  });
13181
13144
  this._defaultGrep = /.*/;
@@ -13224,7 +13187,7 @@
13224
13187
  * @param {string} fn - Listener function
13225
13188
  * @private
13226
13189
  */
13227
- Runner.prototype._addEventListener = function(target, eventName, listener) {
13190
+ Runner.prototype._addEventListener = function (target, eventName, listener) {
13228
13191
  debug(
13229
13192
  '_addEventListener(): adding for event %s; %d current listeners',
13230
13193
  eventName,
@@ -13234,10 +13197,7 @@
13234
13197
  if (
13235
13198
  this._eventListeners.has(target) &&
13236
13199
  this._eventListeners.get(target).has(eventName) &&
13237
- this._eventListeners
13238
- .get(target)
13239
- .get(eventName)
13240
- .has(listener)
13200
+ this._eventListeners.get(target).get(eventName).has(listener)
13241
13201
  ) {
13242
13202
  debug(
13243
13203
  'warning: tried to attach duplicate event listener for %s',
@@ -13264,7 +13224,7 @@
13264
13224
  * @param {function} listener - Listener function
13265
13225
  * @private
13266
13226
  */
13267
- Runner.prototype._removeEventListener = function(target, eventName, listener) {
13227
+ Runner.prototype._removeEventListener = function (target, eventName, listener) {
13268
13228
  target.removeListener(eventName, listener);
13269
13229
 
13270
13230
  if (this._eventListeners.has(target)) {
@@ -13288,7 +13248,7 @@
13288
13248
  * Removes all event handlers set during a run on this instance.
13289
13249
  * Remark: this does _not_ clean/dispose the tests or suites themselves.
13290
13250
  */
13291
- Runner.prototype.dispose = function() {
13251
+ Runner.prototype.dispose = function () {
13292
13252
  this.removeAllListeners();
13293
13253
  this._eventListeners.forEach((targetListeners, target) => {
13294
13254
  targetListeners.forEach((targetEventListeners, eventName) => {
@@ -13310,7 +13270,7 @@
13310
13270
  * @param {boolean} invert
13311
13271
  * @return {Runner} Runner instance.
13312
13272
  */
13313
- Runner.prototype.grep = function(re, invert) {
13273
+ Runner.prototype.grep = function (re, invert) {
13314
13274
  debug('grep(): setting to %s', re);
13315
13275
  this._grep = re;
13316
13276
  this._invert = invert;
@@ -13327,11 +13287,11 @@
13327
13287
  * @param {Suite} suite
13328
13288
  * @return {number}
13329
13289
  */
13330
- Runner.prototype.grepTotal = function(suite) {
13290
+ Runner.prototype.grepTotal = function (suite) {
13331
13291
  var self = this;
13332
13292
  var total = 0;
13333
13293
 
13334
- suite.eachTest(function(test) {
13294
+ suite.eachTest(function (test) {
13335
13295
  var match = self._grep.test(test.fullTitle());
13336
13296
  if (self._invert) {
13337
13297
  match = !match;
@@ -13350,7 +13310,7 @@
13350
13310
  * @return {Array}
13351
13311
  * @private
13352
13312
  */
13353
- Runner.prototype.globalProps = function() {
13313
+ Runner.prototype.globalProps = function () {
13354
13314
  var props = Object.keys(commonjsGlobal);
13355
13315
 
13356
13316
  // non-enumerables
@@ -13372,7 +13332,7 @@
13372
13332
  * @param {Array} arr
13373
13333
  * @return {Runner} Runner instance.
13374
13334
  */
13375
- Runner.prototype.globals = function(arr) {
13335
+ Runner.prototype.globals = function (arr) {
13376
13336
  if (!arguments.length) {
13377
13337
  return this._globals;
13378
13338
  }
@@ -13386,7 +13346,7 @@
13386
13346
  *
13387
13347
  * @private
13388
13348
  */
13389
- Runner.prototype.checkGlobals = function(test) {
13349
+ Runner.prototype.checkGlobals = function (test) {
13390
13350
  if (!this.checkLeaks) {
13391
13351
  return;
13392
13352
  }
@@ -13434,7 +13394,7 @@
13434
13394
  * @param {Error} err
13435
13395
  * @param {boolean} [force=false] - Whether to fail a pending test.
13436
13396
  */
13437
- Runner.prototype.fail = function(test, err, force) {
13397
+ Runner.prototype.fail = function (test, err, force) {
13438
13398
  force = force === true;
13439
13399
  if (test.isPending() && !force) {
13440
13400
  return;
@@ -13475,7 +13435,7 @@
13475
13435
  * @param {Function} fn
13476
13436
  */
13477
13437
 
13478
- Runner.prototype.hook = function(name, fn) {
13438
+ Runner.prototype.hook = function (name, fn) {
13479
13439
  if (this._opts.dryRun) return fn();
13480
13440
 
13481
13441
  var suite = this.suite;
@@ -13504,7 +13464,7 @@
13504
13464
  self.emit(constants$1.EVENT_HOOK_BEGIN, hook);
13505
13465
 
13506
13466
  if (!hook.listeners('error').length) {
13507
- self._addEventListener(hook, 'error', function(err) {
13467
+ self._addEventListener(hook, 'error', function (err) {
13508
13468
  self.fail(hook, err);
13509
13469
  });
13510
13470
  }
@@ -13529,10 +13489,10 @@
13529
13489
  hook.pending = false; // activates hook for next test
13530
13490
  return fn(new Error('abort hookDown'));
13531
13491
  } else if (name === HOOK_TYPE_BEFORE_ALL) {
13532
- suite.tests.forEach(function(test) {
13492
+ suite.tests.forEach(function (test) {
13533
13493
  test.pending = true;
13534
13494
  });
13535
- suite.suites.forEach(function(suite) {
13495
+ suite.suites.forEach(function (suite) {
13536
13496
  suite.pending = true;
13537
13497
  });
13538
13498
  hooks = [];
@@ -13569,7 +13529,7 @@
13569
13529
  }
13570
13530
  }
13571
13531
 
13572
- Runner.immediately(function() {
13532
+ Runner.immediately(function () {
13573
13533
  next(0);
13574
13534
  });
13575
13535
  };
@@ -13583,7 +13543,7 @@
13583
13543
  * @param {Array} suites
13584
13544
  * @param {Function} fn
13585
13545
  */
13586
- Runner.prototype.hooks = function(name, suites, fn) {
13546
+ Runner.prototype.hooks = function (name, suites, fn) {
13587
13547
  var self = this;
13588
13548
  var orig = this.suite;
13589
13549
 
@@ -13595,7 +13555,7 @@
13595
13555
  return fn();
13596
13556
  }
13597
13557
 
13598
- self.hook(name, function(err) {
13558
+ self.hook(name, function (err) {
13599
13559
  if (err) {
13600
13560
  var errSuite = self.suite;
13601
13561
  self.suite = orig;
@@ -13616,7 +13576,7 @@
13616
13576
  * @param {Function} fn
13617
13577
  * @private
13618
13578
  */
13619
- Runner.prototype.hookUp = function(name, fn) {
13579
+ Runner.prototype.hookUp = function (name, fn) {
13620
13580
  var suites = [this.suite].concat(this.parents()).reverse();
13621
13581
  this.hooks(name, suites, fn);
13622
13582
  };
@@ -13628,7 +13588,7 @@
13628
13588
  * @param {Function} fn
13629
13589
  * @private
13630
13590
  */
13631
- Runner.prototype.hookDown = function(name, fn) {
13591
+ Runner.prototype.hookDown = function (name, fn) {
13632
13592
  var suites = [this.suite].concat(this.parents());
13633
13593
  this.hooks(name, suites, fn);
13634
13594
  };
@@ -13640,7 +13600,7 @@
13640
13600
  * @return {Array}
13641
13601
  * @private
13642
13602
  */
13643
- Runner.prototype.parents = function() {
13603
+ Runner.prototype.parents = function () {
13644
13604
  var suite = this.suite;
13645
13605
  var suites = [];
13646
13606
  while (suite.parent) {
@@ -13656,7 +13616,7 @@
13656
13616
  * @param {Function} fn
13657
13617
  * @private
13658
13618
  */
13659
- Runner.prototype.runTest = function(fn) {
13619
+ Runner.prototype.runTest = function (fn) {
13660
13620
  if (this._opts.dryRun) return fn();
13661
13621
 
13662
13622
  var self = this;
@@ -13669,7 +13629,7 @@
13669
13629
  if (this.asyncOnly) {
13670
13630
  test.asyncOnly = true;
13671
13631
  }
13672
- this._addEventListener(test, 'error', function(err) {
13632
+ this._addEventListener(test, 'error', function (err) {
13673
13633
  self.fail(test, err);
13674
13634
  });
13675
13635
  if (this.allowUncaught) {
@@ -13690,7 +13650,7 @@
13690
13650
  * @param {Suite} suite
13691
13651
  * @param {Function} fn
13692
13652
  */
13693
- Runner.prototype.runTests = function(suite, fn) {
13653
+ Runner.prototype.runTests = function (suite, fn) {
13694
13654
  var self = this;
13695
13655
  var tests = suite.tests.slice();
13696
13656
  var test;
@@ -13704,7 +13664,7 @@
13704
13664
  self.suite = after ? errSuite.parent : errSuite;
13705
13665
 
13706
13666
  if (self.suite) {
13707
- self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
13667
+ self.hookUp(HOOK_TYPE_AFTER_EACH, function (err2, errSuite2) {
13708
13668
  self.suite = orig;
13709
13669
  // some hooks may fail even now
13710
13670
  if (err2) {
@@ -13778,7 +13738,7 @@
13778
13738
 
13779
13739
  // execute test and hook(s)
13780
13740
  self.emit(constants$1.EVENT_TEST_BEGIN, (self.test = test));
13781
- self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
13741
+ self.hookDown(HOOK_TYPE_BEFORE_EACH, function (err, errSuite) {
13782
13742
  // conditional skip within beforeEach
13783
13743
  if (test.isPending()) {
13784
13744
  if (self.forbidPending) {
@@ -13791,7 +13751,7 @@
13791
13751
  // skip inner afterEach hooks below errSuite level
13792
13752
  var origSuite = self.suite;
13793
13753
  self.suite = errSuite || self.suite;
13794
- return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
13754
+ return self.hookUp(HOOK_TYPE_AFTER_EACH, function (e, eSuite) {
13795
13755
  self.suite = origSuite;
13796
13756
  next(e, eSuite);
13797
13757
  });
@@ -13800,7 +13760,7 @@
13800
13760
  return hookErr(err, errSuite, false);
13801
13761
  }
13802
13762
  self.currentRunnable = self.test;
13803
- self.runTest(function(err) {
13763
+ self.runTest(function (err) {
13804
13764
  test = self.test;
13805
13765
  // conditional skip within it
13806
13766
  if (test.pending) {
@@ -13851,7 +13811,7 @@
13851
13811
  * @param {Suite} suite
13852
13812
  * @param {Function} fn
13853
13813
  */
13854
- Runner.prototype.runSuite = function(suite, fn) {
13814
+ Runner.prototype.runSuite = function (suite, fn) {
13855
13815
  var i = 0;
13856
13816
  var self = this;
13857
13817
  var total = this.grepTotal(suite);
@@ -13891,7 +13851,7 @@
13891
13851
  // huge recursive loop and thus a maximum call stack error.
13892
13852
  // See comment in `this.runTests()` for more information.
13893
13853
  if (self._grep !== self._defaultGrep) {
13894
- Runner.immediately(function() {
13854
+ Runner.immediately(function () {
13895
13855
  self.runSuite(curr, next);
13896
13856
  });
13897
13857
  } else {
@@ -13906,7 +13866,7 @@
13906
13866
  // remove reference to test
13907
13867
  delete self.test;
13908
13868
 
13909
- self.hook(HOOK_TYPE_AFTER_ALL, function() {
13869
+ self.hook(HOOK_TYPE_AFTER_ALL, function () {
13910
13870
  self.emit(constants$1.EVENT_SUITE_END, suite);
13911
13871
  fn(errSuite);
13912
13872
  });
@@ -13914,7 +13874,7 @@
13914
13874
 
13915
13875
  this.nextSuite = next;
13916
13876
 
13917
- this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
13877
+ this.hook(HOOK_TYPE_BEFORE_ALL, function (err) {
13918
13878
  if (err) {
13919
13879
  return done();
13920
13880
  }
@@ -13938,7 +13898,7 @@
13938
13898
  * @param {Error} err - Some uncaught error
13939
13899
  * @private
13940
13900
  */
13941
- Runner.prototype._uncaught = function(err) {
13901
+ Runner.prototype._uncaught = function (err) {
13942
13902
  // this is defensive to prevent future developers from mis-calling this function.
13943
13903
  // it's more likely that it'd be called with the incorrect context--say, the global
13944
13904
  // `process` object--than it would to be called with a context that is not a "subclass"
@@ -14036,12 +13996,12 @@
14036
13996
  * @param {{files: string[], options: Options}} [opts] - For subclasses
14037
13997
  * @returns {Runner} Runner instance.
14038
13998
  */
14039
- Runner.prototype.run = function(fn, opts = {}) {
13999
+ Runner.prototype.run = function (fn, opts = {}) {
14040
14000
  var rootSuite = this.suite;
14041
14001
  var options = opts.options || {};
14042
14002
 
14043
14003
  debug('run(): got options: %O', options);
14044
- fn = fn || function() {};
14004
+ fn = fn || function () {};
14045
14005
 
14046
14006
  const end = () => {
14047
14007
  if (!this.total && this._opts.failZero) this.failures = 1;
@@ -14082,7 +14042,7 @@
14082
14042
  }
14083
14043
 
14084
14044
  // callback
14085
- this.on(constants$1.EVENT_RUN_END, function() {
14045
+ this.on(constants$1.EVENT_RUN_END, function () {
14086
14046
  this.state = constants$1.STATE_STOPPED;
14087
14047
  debug('run(): emitted %s', constants$1.EVENT_RUN_END);
14088
14048
  fn(this.failures);
@@ -14129,7 +14089,7 @@
14129
14089
  * }
14130
14090
  * }
14131
14091
  */
14132
- Runner.prototype.linkPartialObjects = function(value) {
14092
+ Runner.prototype.linkPartialObjects = function (value) {
14133
14093
  return this;
14134
14094
  };
14135
14095
 
@@ -14154,7 +14114,7 @@
14154
14114
  * @public
14155
14115
  * @return {Runner} Runner instance.
14156
14116
  */
14157
- Runner.prototype.abort = function() {
14117
+ Runner.prototype.abort = function () {
14158
14118
  debug('abort(): aborting');
14159
14119
  this._abort = true;
14160
14120
 
@@ -14182,7 +14142,7 @@
14182
14142
  * @chainable
14183
14143
  * @abstract
14184
14144
  */
14185
- Runner.prototype.workerReporter = function() {
14145
+ Runner.prototype.workerReporter = function () {
14186
14146
  throw createUnsupportedError$1('workerReporter() not supported in serial mode');
14187
14147
  };
14188
14148
 
@@ -14195,7 +14155,7 @@
14195
14155
  * @return {Array}
14196
14156
  */
14197
14157
  function filterLeaks(ok, globals) {
14198
- return globals.filter(function(key) {
14158
+ return globals.filter(function (key) {
14199
14159
  // Firefox and Chrome exposes iframes as index inside the window object
14200
14160
  if (/^\d+/.test(key)) {
14201
14161
  return false;
@@ -14219,7 +14179,7 @@
14219
14179
  return false;
14220
14180
  }
14221
14181
 
14222
- var matched = ok.filter(function(ok) {
14182
+ var matched = ok.filter(function (ok) {
14223
14183
  if (~ok.indexOf('*')) {
14224
14184
  return key.indexOf(ok.split('*')[0]) === 0;
14225
14185
  }
@@ -14267,7 +14227,7 @@
14267
14227
 
14268
14228
  var runner = Runner;
14269
14229
 
14270
- var require$$11 = getCjsExportFromNamespace(_nodeResolve_empty$1);
14230
+ var require$$10 = getCjsExportFromNamespace(_nodeResolve_empty$1);
14271
14231
 
14272
14232
  var base = createCommonjsModule(function (module, exports) {
14273
14233
  /**
@@ -14319,7 +14279,7 @@
14319
14279
 
14320
14280
  exports.useColors =
14321
14281
  !isBrowser &&
14322
- (require$$11.stdout || process$1.env.MOCHA_COLORS !== undefined);
14282
+ (require$$10.stdout || process$1.env.MOCHA_COLORS !== undefined);
14323
14283
 
14324
14284
  /**
14325
14285
  * Inline diffs instead of +/-
@@ -14378,7 +14338,7 @@
14378
14338
  * @param {string} str
14379
14339
  * @return {string}
14380
14340
  */
14381
- var color = (exports.color = function(type, str) {
14341
+ var color = (exports.color = function (type, str) {
14382
14342
  if (!exports.useColors) {
14383
14343
  return String(str);
14384
14344
  }
@@ -14406,23 +14366,23 @@
14406
14366
  */
14407
14367
 
14408
14368
  exports.cursor = {
14409
- hide: function() {
14369
+ hide: function () {
14410
14370
  isatty && process$1.stdout.write('\u001b[?25l');
14411
14371
  },
14412
14372
 
14413
- show: function() {
14373
+ show: function () {
14414
14374
  isatty && process$1.stdout.write('\u001b[?25h');
14415
14375
  },
14416
14376
 
14417
- deleteLine: function() {
14377
+ deleteLine: function () {
14418
14378
  isatty && process$1.stdout.write('\u001b[2K');
14419
14379
  },
14420
14380
 
14421
- beginningOfLine: function() {
14381
+ beginningOfLine: function () {
14422
14382
  isatty && process$1.stdout.write('\u001b[0G');
14423
14383
  },
14424
14384
 
14425
- CR: function() {
14385
+ CR: function () {
14426
14386
  if (isatty) {
14427
14387
  exports.cursor.deleteLine();
14428
14388
  exports.cursor.beginningOfLine();
@@ -14432,7 +14392,7 @@
14432
14392
  }
14433
14393
  };
14434
14394
 
14435
- var showDiff = (exports.showDiff = function(err) {
14395
+ var showDiff = (exports.showDiff = function (err) {
14436
14396
  return (
14437
14397
  err &&
14438
14398
  err.showDiff !== false &&
@@ -14459,7 +14419,7 @@
14459
14419
  * @param {string} expected
14460
14420
  * @return {string} Diff
14461
14421
  */
14462
- var generateDiff = (exports.generateDiff = function(actual, expected) {
14422
+ var generateDiff = (exports.generateDiff = function (actual, expected) {
14463
14423
  try {
14464
14424
  const diffSize = 2048;
14465
14425
  if (actual.length > diffSize) {
@@ -14491,10 +14451,10 @@
14491
14451
  * @param {Object[]} failures - Each is Test instance with corresponding
14492
14452
  * Error property
14493
14453
  */
14494
- exports.list = function(failures) {
14454
+ exports.list = function (failures) {
14495
14455
  var multipleErr, multipleTest;
14496
14456
  Base.consoleLog();
14497
- failures.forEach(function(test, i) {
14457
+ failures.forEach(function (test, i) {
14498
14458
  // format
14499
14459
  var fmt =
14500
14460
  color('error title', ' %s) %s:\n') +
@@ -14553,7 +14513,7 @@
14553
14513
 
14554
14514
  // indented test title
14555
14515
  var testTitle = '';
14556
- test.titlePath().forEach(function(str, index) {
14516
+ test.titlePath().forEach(function (str, index) {
14557
14517
  if (index !== 0) {
14558
14518
  testTitle += '\n ';
14559
14519
  }
@@ -14589,7 +14549,7 @@
14589
14549
  this.runner = runner;
14590
14550
  this.stats = runner.stats; // assigned so Reporters keep a closer reference
14591
14551
 
14592
- runner.on(EVENT_TEST_PASS, function(test) {
14552
+ runner.on(EVENT_TEST_PASS, function (test) {
14593
14553
  if (test.duration > test.slow()) {
14594
14554
  test.speed = 'slow';
14595
14555
  } else if (test.duration > test.slow() / 2) {
@@ -14599,7 +14559,7 @@
14599
14559
  }
14600
14560
  });
14601
14561
 
14602
- runner.on(EVENT_TEST_FAIL, function(test, err) {
14562
+ runner.on(EVENT_TEST_FAIL, function (test, err) {
14603
14563
  if (showDiff(err)) {
14604
14564
  stringifyDiffObjs(err);
14605
14565
  }
@@ -14619,7 +14579,7 @@
14619
14579
  * @public
14620
14580
  * @memberof Mocha.reporters
14621
14581
  */
14622
- Base.prototype.epilogue = function() {
14582
+ Base.prototype.epilogue = function () {
14623
14583
  var stats = this.stats;
14624
14584
  var fmt;
14625
14585
 
@@ -14682,7 +14642,7 @@
14682
14642
  if (lines.length > 4) {
14683
14643
  var width = String(lines.length).length;
14684
14644
  msg = lines
14685
- .map(function(str, i) {
14645
+ .map(function (str, i) {
14686
14646
  return pad(++i, width) + ' |' + ' ' + str;
14687
14647
  })
14688
14648
  .join('\n');
@@ -14739,10 +14699,7 @@
14739
14699
  ' ' +
14740
14700
  colorLines('diff removed', '- actual') +
14741
14701
  '\n\n' +
14742
- lines
14743
- .map(cleanUp)
14744
- .filter(notBlank)
14745
- .join('\n')
14702
+ lines.map(cleanUp).filter(notBlank).join('\n')
14746
14703
  );
14747
14704
  }
14748
14705
 
@@ -14757,7 +14714,7 @@
14757
14714
  function errorDiff(actual, expected) {
14758
14715
  return diff$1
14759
14716
  .diffWordsWithSpace(actual, expected)
14760
- .map(function(str) {
14717
+ .map(function (str) {
14761
14718
  if (str.added) {
14762
14719
  return colorLines('diff added inline', str.value);
14763
14720
  }
@@ -14780,7 +14737,7 @@
14780
14737
  function colorLines(name, str) {
14781
14738
  return str
14782
14739
  .split('\n')
14783
- .map(function(str) {
14740
+ .map(function (str) {
14784
14741
  return color(name, str);
14785
14742
  })
14786
14743
  .join('\n');
@@ -14848,18 +14805,18 @@
14848
14805
  var width = (base.window.width * 0.75) | 0;
14849
14806
  var n = -1;
14850
14807
 
14851
- runner.on(EVENT_RUN_BEGIN, function() {
14808
+ runner.on(EVENT_RUN_BEGIN, function () {
14852
14809
  process$1.stdout.write('\n');
14853
14810
  });
14854
14811
 
14855
- runner.on(EVENT_TEST_PENDING, function() {
14812
+ runner.on(EVENT_TEST_PENDING, function () {
14856
14813
  if (++n % width === 0) {
14857
14814
  process$1.stdout.write('\n ');
14858
14815
  }
14859
14816
  process$1.stdout.write(base.color('pending', base.symbols.comma));
14860
14817
  });
14861
14818
 
14862
- runner.on(EVENT_TEST_PASS, function(test) {
14819
+ runner.on(EVENT_TEST_PASS, function (test) {
14863
14820
  if (++n % width === 0) {
14864
14821
  process$1.stdout.write('\n ');
14865
14822
  }
@@ -14870,14 +14827,14 @@
14870
14827
  }
14871
14828
  });
14872
14829
 
14873
- runner.on(EVENT_TEST_FAIL, function() {
14830
+ runner.on(EVENT_TEST_FAIL, function () {
14874
14831
  if (++n % width === 0) {
14875
14832
  process$1.stdout.write('\n ');
14876
14833
  }
14877
14834
  process$1.stdout.write(base.color('fail', base.symbols.bang));
14878
14835
  });
14879
14836
 
14880
- runner.once(EVENT_RUN_END, function() {
14837
+ runner.once(EVENT_RUN_END, function () {
14881
14838
  process$1.stdout.write('\n');
14882
14839
  self.epilogue();
14883
14840
  });
@@ -14932,7 +14889,7 @@
14932
14889
  return Array(indents).join(' ');
14933
14890
  }
14934
14891
 
14935
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
14892
+ runner.on(EVENT_SUITE_BEGIN, function (suite) {
14936
14893
  if (suite.root) {
14937
14894
  return;
14938
14895
  }
@@ -14943,7 +14900,7 @@
14943
14900
  base.consoleLog('%s<dl>', indent());
14944
14901
  });
14945
14902
 
14946
- runner.on(EVENT_SUITE_END, function(suite) {
14903
+ runner.on(EVENT_SUITE_END, function (suite) {
14947
14904
  if (suite.root) {
14948
14905
  return;
14949
14906
  }
@@ -14953,14 +14910,14 @@
14953
14910
  --indents;
14954
14911
  });
14955
14912
 
14956
- runner.on(EVENT_TEST_PASS, function(test) {
14913
+ runner.on(EVENT_TEST_PASS, function (test) {
14957
14914
  base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
14958
14915
  base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.file));
14959
14916
  var code = utils.escape(utils.clean(test.body));
14960
14917
  base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
14961
14918
  });
14962
14919
 
14963
- runner.on(EVENT_TEST_FAIL, function(test, err) {
14920
+ runner.on(EVENT_TEST_FAIL, function (test, err) {
14964
14921
  base.consoleLog(
14965
14922
  '%s <dt class="error">%s</dt>',
14966
14923
  indent(),
@@ -15039,27 +14996,27 @@
15039
14996
 
15040
14997
  this._producer = createProducer(tapVersion);
15041
14998
 
15042
- runner.once(EVENT_RUN_BEGIN, function() {
14999
+ runner.once(EVENT_RUN_BEGIN, function () {
15043
15000
  self._producer.writeVersion();
15044
15001
  });
15045
15002
 
15046
- runner.on(EVENT_TEST_END, function() {
15003
+ runner.on(EVENT_TEST_END, function () {
15047
15004
  ++n;
15048
15005
  });
15049
15006
 
15050
- runner.on(EVENT_TEST_PENDING, function(test) {
15007
+ runner.on(EVENT_TEST_PENDING, function (test) {
15051
15008
  self._producer.writePending(n, test);
15052
15009
  });
15053
15010
 
15054
- runner.on(EVENT_TEST_PASS, function(test) {
15011
+ runner.on(EVENT_TEST_PASS, function (test) {
15055
15012
  self._producer.writePass(n, test);
15056
15013
  });
15057
15014
 
15058
- runner.on(EVENT_TEST_FAIL, function(test, err) {
15015
+ runner.on(EVENT_TEST_FAIL, function (test, err) {
15059
15016
  self._producer.writeFail(n, test, err);
15060
15017
  });
15061
15018
 
15062
- runner.once(EVENT_RUN_END, function() {
15019
+ runner.once(EVENT_RUN_END, function () {
15063
15020
  self._producer.writeEpilogue(runner.stats);
15064
15021
  });
15065
15022
  }
@@ -15103,8 +15060,8 @@
15103
15060
  */
15104
15061
  function createProducer(tapVersion) {
15105
15062
  var producers = {
15106
- '12': new TAP12Producer(),
15107
- '13': new TAP13Producer()
15063
+ 12: new TAP12Producer(),
15064
+ 13: new TAP13Producer()
15108
15065
  };
15109
15066
  var producer = producers[tapVersion];
15110
15067
 
@@ -15134,7 +15091,7 @@
15134
15091
  *
15135
15092
  * @abstract
15136
15093
  */
15137
- TAPProducer.prototype.writeVersion = function() {};
15094
+ TAPProducer.prototype.writeVersion = function () {};
15138
15095
 
15139
15096
  /**
15140
15097
  * Writes the plan to reporter output stream.
@@ -15142,7 +15099,7 @@
15142
15099
  * @abstract
15143
15100
  * @param {number} ntests - Number of tests that are planned to run.
15144
15101
  */
15145
- TAPProducer.prototype.writePlan = function(ntests) {
15102
+ TAPProducer.prototype.writePlan = function (ntests) {
15146
15103
  println('%d..%d', 1, ntests);
15147
15104
  };
15148
15105
 
@@ -15153,7 +15110,7 @@
15153
15110
  * @param {number} n - Index of test that passed.
15154
15111
  * @param {Test} test - Instance containing test information.
15155
15112
  */
15156
- TAPProducer.prototype.writePass = function(n, test) {
15113
+ TAPProducer.prototype.writePass = function (n, test) {
15157
15114
  println('ok %d %s', n, title(test));
15158
15115
  };
15159
15116
 
@@ -15164,7 +15121,7 @@
15164
15121
  * @param {number} n - Index of test that was skipped.
15165
15122
  * @param {Test} test - Instance containing test information.
15166
15123
  */
15167
- TAPProducer.prototype.writePending = function(n, test) {
15124
+ TAPProducer.prototype.writePending = function (n, test) {
15168
15125
  println('ok %d %s # SKIP -', n, title(test));
15169
15126
  };
15170
15127
 
@@ -15176,7 +15133,7 @@
15176
15133
  * @param {Test} test - Instance containing test information.
15177
15134
  * @param {Error} err - Reason the test failed.
15178
15135
  */
15179
- TAPProducer.prototype.writeFail = function(n, test, err) {
15136
+ TAPProducer.prototype.writeFail = function (n, test, err) {
15180
15137
  println('not ok %d %s', n, title(test));
15181
15138
  };
15182
15139
 
@@ -15186,7 +15143,7 @@
15186
15143
  * @abstract
15187
15144
  * @param {Object} stats - Object containing run statistics.
15188
15145
  */
15189
- TAPProducer.prototype.writeEpilogue = function(stats) {
15146
+ TAPProducer.prototype.writeEpilogue = function (stats) {
15190
15147
  // :TBD: Why is this not counting pending tests?
15191
15148
  println('# tests ' + (stats.passes + stats.failures));
15192
15149
  println('# pass ' + stats.passes);
@@ -15212,7 +15169,7 @@
15212
15169
  * Writes that test failed to reporter output stream, with error formatting.
15213
15170
  * @override
15214
15171
  */
15215
- this.writeFail = function(n, test, err) {
15172
+ this.writeFail = function (n, test, err) {
15216
15173
  TAPProducer.prototype.writeFail.call(this, n, test, err);
15217
15174
  if (err.message) {
15218
15175
  println(err.message.replace(/^/gm, ' '));
@@ -15245,7 +15202,7 @@
15245
15202
  * Writes the TAP version to reporter output stream.
15246
15203
  * @override
15247
15204
  */
15248
- this.writeVersion = function() {
15205
+ this.writeVersion = function () {
15249
15206
  println('TAP version 13');
15250
15207
  };
15251
15208
 
@@ -15253,7 +15210,7 @@
15253
15210
  * Writes that test failed to reporter output stream, with error formatting.
15254
15211
  * @override
15255
15212
  */
15256
- this.writeFail = function(n, test, err) {
15213
+ this.writeFail = function (n, test, err) {
15257
15214
  TAPProducer.prototype.writeFail.call(this, n, test, err);
15258
15215
  var emitYamlBlock = err.message != null || err.stack != null;
15259
15216
  if (emitYamlBlock) {
@@ -15338,23 +15295,23 @@
15338
15295
  output = options.reporterOption.output;
15339
15296
  }
15340
15297
 
15341
- runner.on(EVENT_TEST_END, function(test) {
15298
+ runner.on(EVENT_TEST_END, function (test) {
15342
15299
  tests.push(test);
15343
15300
  });
15344
15301
 
15345
- runner.on(EVENT_TEST_PASS, function(test) {
15302
+ runner.on(EVENT_TEST_PASS, function (test) {
15346
15303
  passes.push(test);
15347
15304
  });
15348
15305
 
15349
- runner.on(EVENT_TEST_FAIL, function(test) {
15306
+ runner.on(EVENT_TEST_FAIL, function (test) {
15350
15307
  failures.push(test);
15351
15308
  });
15352
15309
 
15353
- runner.on(EVENT_TEST_PENDING, function(test) {
15310
+ runner.on(EVENT_TEST_PENDING, function (test) {
15354
15311
  pending.push(test);
15355
15312
  });
15356
15313
 
15357
- runner.once(EVENT_RUN_END, function() {
15314
+ runner.once(EVENT_RUN_END, function () {
15358
15315
  var obj = {
15359
15316
  stats: self.stats,
15360
15317
  tests: tests.map(clean),
@@ -15417,7 +15374,7 @@
15417
15374
  function cleanCycles(obj) {
15418
15375
  var cache = [];
15419
15376
  return JSON.parse(
15420
- JSON.stringify(obj, function(key, value) {
15377
+ JSON.stringify(obj, function (key, value) {
15421
15378
  if (typeof value === 'object' && value !== null) {
15422
15379
  if (cache.indexOf(value) !== -1) {
15423
15380
  // Instead of going in a circle, we'll print [object Object]
@@ -15440,7 +15397,7 @@
15440
15397
  */
15441
15398
  function errorJSON(err) {
15442
15399
  var res = {};
15443
- Object.getOwnPropertyNames(err).forEach(function(key) {
15400
+ Object.getOwnPropertyNames(err).forEach(function (key) {
15444
15401
  res[key] = err[key];
15445
15402
  }, err);
15446
15403
  return res;
@@ -15476,7 +15433,7 @@
15476
15433
  * @param {number} size
15477
15434
  * @return {Progress} Progress instance.
15478
15435
  */
15479
- Progress.prototype.size = function(size) {
15436
+ Progress.prototype.size = function (size) {
15480
15437
  this._size = size;
15481
15438
  return this;
15482
15439
  };
@@ -15488,7 +15445,7 @@
15488
15445
  * @param {string} text
15489
15446
  * @return {Progress} Progress instance.
15490
15447
  */
15491
- Progress.prototype.text = function(text) {
15448
+ Progress.prototype.text = function (text) {
15492
15449
  this._text = text;
15493
15450
  return this;
15494
15451
  };
@@ -15500,7 +15457,7 @@
15500
15457
  * @param {number} size
15501
15458
  * @return {Progress} Progress instance.
15502
15459
  */
15503
- Progress.prototype.fontSize = function(size) {
15460
+ Progress.prototype.fontSize = function (size) {
15504
15461
  this._fontSize = size;
15505
15462
  return this;
15506
15463
  };
@@ -15511,7 +15468,7 @@
15511
15468
  * @param {string} family
15512
15469
  * @return {Progress} Progress instance.
15513
15470
  */
15514
- Progress.prototype.font = function(family) {
15471
+ Progress.prototype.font = function (family) {
15515
15472
  this._font = family;
15516
15473
  return this;
15517
15474
  };
@@ -15522,7 +15479,7 @@
15522
15479
  * @param {number} n
15523
15480
  * @return {Progress} Progress instance.
15524
15481
  */
15525
- Progress.prototype.update = function(n) {
15482
+ Progress.prototype.update = function (n) {
15526
15483
  this.percent = n;
15527
15484
  return this;
15528
15485
  };
@@ -15533,7 +15490,7 @@
15533
15490
  * @param {CanvasRenderingContext2d} ctx
15534
15491
  * @return {Progress} Progress instance.
15535
15492
  */
15536
- Progress.prototype.draw = function(ctx) {
15493
+ Progress.prototype.draw = function (ctx) {
15537
15494
  try {
15538
15495
  var percent = Math.min(this.percent, 100);
15539
15496
  var size = this._size;
@@ -15664,7 +15621,7 @@
15664
15621
  }
15665
15622
 
15666
15623
  // pass toggle
15667
- on(passesLink, 'click', function(evt) {
15624
+ on(passesLink, 'click', function (evt) {
15668
15625
  evt.preventDefault();
15669
15626
  unhide();
15670
15627
  var name = /pass/.test(report.className) ? '' : ' pass';
@@ -15675,7 +15632,7 @@
15675
15632
  });
15676
15633
 
15677
15634
  // failure toggle
15678
- on(failuresLink, 'click', function(evt) {
15635
+ on(failuresLink, 'click', function (evt) {
15679
15636
  evt.preventDefault();
15680
15637
  unhide();
15681
15638
  var name = /fail/.test(report.className) ? '' : ' fail';
@@ -15692,7 +15649,7 @@
15692
15649
  progress.size(40);
15693
15650
  }
15694
15651
 
15695
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
15652
+ runner.on(EVENT_SUITE_BEGIN, function (suite) {
15696
15653
  if (suite.root) {
15697
15654
  return;
15698
15655
  }
@@ -15711,7 +15668,7 @@
15711
15668
  el.appendChild(stack[0]);
15712
15669
  });
15713
15670
 
15714
- runner.on(EVENT_SUITE_END, function(suite) {
15671
+ runner.on(EVENT_SUITE_END, function (suite) {
15715
15672
  if (suite.root) {
15716
15673
  updateStats();
15717
15674
  return;
@@ -15719,7 +15676,7 @@
15719
15676
  stack.shift();
15720
15677
  });
15721
15678
 
15722
- runner.on(EVENT_TEST_PASS, function(test) {
15679
+ runner.on(EVENT_TEST_PASS, function (test) {
15723
15680
  var url = self.testURL(test);
15724
15681
  var markup =
15725
15682
  '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
@@ -15732,7 +15689,7 @@
15732
15689
  updateStats();
15733
15690
  });
15734
15691
 
15735
- runner.on(EVENT_TEST_FAIL, function(test) {
15692
+ runner.on(EVENT_TEST_FAIL, function (test) {
15736
15693
  var el = fragment(
15737
15694
  '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
15738
15695
  playIcon +
@@ -15788,7 +15745,7 @@
15788
15745
  updateStats();
15789
15746
  });
15790
15747
 
15791
- runner.on(EVENT_TEST_PENDING, function(test) {
15748
+ runner.on(EVENT_TEST_PENDING, function (test) {
15792
15749
  var el = fragment(
15793
15750
  '<li class="test pass pending"><h2>%e</h2></li>',
15794
15751
  test.title
@@ -15846,7 +15803,7 @@
15846
15803
  *
15847
15804
  * @param {Object} [suite]
15848
15805
  */
15849
- HTML.prototype.suiteURL = function(suite) {
15806
+ HTML.prototype.suiteURL = function (suite) {
15850
15807
  return makeUrl(suite.fullTitle());
15851
15808
  };
15852
15809
 
@@ -15855,7 +15812,7 @@
15855
15812
  *
15856
15813
  * @param {Object} [test]
15857
15814
  */
15858
- HTML.prototype.testURL = function(test) {
15815
+ HTML.prototype.testURL = function (test) {
15859
15816
  return makeUrl(test.fullTitle());
15860
15817
  };
15861
15818
 
@@ -15865,10 +15822,10 @@
15865
15822
  * @param {HTMLLIElement} el
15866
15823
  * @param {string} contents
15867
15824
  */
15868
- HTML.prototype.addCodeToggle = function(el, contents) {
15825
+ HTML.prototype.addCodeToggle = function (el, contents) {
15869
15826
  var h2 = el.getElementsByTagName('h2')[0];
15870
15827
 
15871
- on(h2, 'click', function() {
15828
+ on(h2, 'click', function () {
15872
15829
  pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
15873
15830
  });
15874
15831
 
@@ -15896,7 +15853,7 @@
15896
15853
  var div = document.createElement('div');
15897
15854
  var i = 1;
15898
15855
 
15899
- div.innerHTML = html.replace(/%([se])/g, function(_, type) {
15856
+ div.innerHTML = html.replace(/%([se])/g, function (_, type) {
15900
15857
  switch (type) {
15901
15858
  case 's':
15902
15859
  return String(args[i++]);
@@ -16005,20 +15962,20 @@
16005
15962
  var self = this;
16006
15963
  var n = 0;
16007
15964
 
16008
- runner.on(EVENT_RUN_BEGIN, function() {
15965
+ runner.on(EVENT_RUN_BEGIN, function () {
16009
15966
  base.consoleLog();
16010
15967
  });
16011
15968
 
16012
- runner.on(EVENT_TEST_BEGIN, function(test) {
15969
+ runner.on(EVENT_TEST_BEGIN, function (test) {
16013
15970
  process$1.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
16014
15971
  });
16015
15972
 
16016
- runner.on(EVENT_TEST_PENDING, function(test) {
15973
+ runner.on(EVENT_TEST_PENDING, function (test) {
16017
15974
  var fmt = color('checkmark', ' -') + color('pending', ' %s');
16018
15975
  base.consoleLog(fmt, test.fullTitle());
16019
15976
  });
16020
15977
 
16021
- runner.on(EVENT_TEST_PASS, function(test) {
15978
+ runner.on(EVENT_TEST_PASS, function (test) {
16022
15979
  var fmt =
16023
15980
  color('checkmark', ' ' + base.symbols.ok) +
16024
15981
  color('pass', ' %s: ') +
@@ -16027,7 +15984,7 @@
16027
15984
  base.consoleLog(fmt, test.fullTitle(), test.duration);
16028
15985
  });
16029
15986
 
16030
- runner.on(EVENT_TEST_FAIL, function(test) {
15987
+ runner.on(EVENT_TEST_FAIL, function (test) {
16031
15988
  cursor.CR();
16032
15989
  base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
16033
15990
  });
@@ -16079,7 +16036,7 @@
16079
16036
  function Min(runner, options) {
16080
16037
  base.call(this, runner, options);
16081
16038
 
16082
- runner.on(EVENT_RUN_BEGIN, function() {
16039
+ runner.on(EVENT_RUN_BEGIN, function () {
16083
16040
  // clear screen
16084
16041
  process$1.stdout.write('\u001b[2J');
16085
16042
  // set cursor position
@@ -16144,28 +16101,28 @@
16144
16101
  return Array(indents).join(' ');
16145
16102
  }
16146
16103
 
16147
- runner.on(EVENT_RUN_BEGIN, function() {
16104
+ runner.on(EVENT_RUN_BEGIN, function () {
16148
16105
  base.consoleLog();
16149
16106
  });
16150
16107
 
16151
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
16108
+ runner.on(EVENT_SUITE_BEGIN, function (suite) {
16152
16109
  ++indents;
16153
16110
  base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
16154
16111
  });
16155
16112
 
16156
- runner.on(EVENT_SUITE_END, function() {
16113
+ runner.on(EVENT_SUITE_END, function () {
16157
16114
  --indents;
16158
16115
  if (indents === 1) {
16159
16116
  base.consoleLog();
16160
16117
  }
16161
16118
  });
16162
16119
 
16163
- runner.on(EVENT_TEST_PENDING, function(test) {
16120
+ runner.on(EVENT_TEST_PENDING, function (test) {
16164
16121
  var fmt = indent() + color('pending', ' - %s');
16165
16122
  base.consoleLog(fmt, test.title);
16166
16123
  });
16167
16124
 
16168
- runner.on(EVENT_TEST_PASS, function(test) {
16125
+ runner.on(EVENT_TEST_PASS, function (test) {
16169
16126
  var fmt;
16170
16127
  if (test.speed === 'fast') {
16171
16128
  fmt =
@@ -16183,7 +16140,7 @@
16183
16140
  }
16184
16141
  });
16185
16142
 
16186
- runner.on(EVENT_TEST_FAIL, function(test) {
16143
+ runner.on(EVENT_TEST_FAIL, function (test) {
16187
16144
  base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
16188
16145
  });
16189
16146
 
@@ -16246,24 +16203,24 @@
16246
16203
  this.trajectories = [[], [], [], []];
16247
16204
  this.trajectoryWidthMax = width - nyanCatWidth;
16248
16205
 
16249
- runner.on(EVENT_RUN_BEGIN, function() {
16206
+ runner.on(EVENT_RUN_BEGIN, function () {
16250
16207
  base.cursor.hide();
16251
16208
  self.draw();
16252
16209
  });
16253
16210
 
16254
- runner.on(EVENT_TEST_PENDING, function() {
16211
+ runner.on(EVENT_TEST_PENDING, function () {
16255
16212
  self.draw();
16256
16213
  });
16257
16214
 
16258
- runner.on(EVENT_TEST_PASS, function() {
16215
+ runner.on(EVENT_TEST_PASS, function () {
16259
16216
  self.draw();
16260
16217
  });
16261
16218
 
16262
- runner.on(EVENT_TEST_FAIL, function() {
16219
+ runner.on(EVENT_TEST_FAIL, function () {
16263
16220
  self.draw();
16264
16221
  });
16265
16222
 
16266
- runner.once(EVENT_RUN_END, function() {
16223
+ runner.once(EVENT_RUN_END, function () {
16267
16224
  base.cursor.show();
16268
16225
  for (var i = 0; i < self.numberOfLines; i++) {
16269
16226
  write('\n');
@@ -16283,7 +16240,7 @@
16283
16240
  * @private
16284
16241
  */
16285
16242
 
16286
- NyanCat.prototype.draw = function() {
16243
+ NyanCat.prototype.draw = function () {
16287
16244
  this.appendRainbow();
16288
16245
  this.drawScoreboard();
16289
16246
  this.drawRainbow();
@@ -16298,7 +16255,7 @@
16298
16255
  * @private
16299
16256
  */
16300
16257
 
16301
- NyanCat.prototype.drawScoreboard = function() {
16258
+ NyanCat.prototype.drawScoreboard = function () {
16302
16259
  var stats = this.stats;
16303
16260
 
16304
16261
  function draw(type, n) {
@@ -16321,7 +16278,7 @@
16321
16278
  * @private
16322
16279
  */
16323
16280
 
16324
- NyanCat.prototype.appendRainbow = function() {
16281
+ NyanCat.prototype.appendRainbow = function () {
16325
16282
  var segment = this.tick ? '_' : '-';
16326
16283
  var rainbowified = this.rainbowify(segment);
16327
16284
 
@@ -16340,10 +16297,10 @@
16340
16297
  * @private
16341
16298
  */
16342
16299
 
16343
- NyanCat.prototype.drawRainbow = function() {
16300
+ NyanCat.prototype.drawRainbow = function () {
16344
16301
  var self = this;
16345
16302
 
16346
- this.trajectories.forEach(function(line) {
16303
+ this.trajectories.forEach(function (line) {
16347
16304
  write('\u001b[' + self.scoreboardWidth + 'C');
16348
16305
  write(line.join(''));
16349
16306
  write('\n');
@@ -16357,7 +16314,7 @@
16357
16314
  *
16358
16315
  * @private
16359
16316
  */
16360
- NyanCat.prototype.drawNyanCat = function() {
16317
+ NyanCat.prototype.drawNyanCat = function () {
16361
16318
  var self = this;
16362
16319
  var startWidth = this.scoreboardWidth + this.trajectories[0].length;
16363
16320
  var dist = '\u001b[' + startWidth + 'C';
@@ -16393,7 +16350,7 @@
16393
16350
  * @return {string}
16394
16351
  */
16395
16352
 
16396
- NyanCat.prototype.face = function() {
16353
+ NyanCat.prototype.face = function () {
16397
16354
  var stats = this.stats;
16398
16355
  if (stats.failures) {
16399
16356
  return '( x .x)';
@@ -16412,7 +16369,7 @@
16412
16369
  * @param {number} n
16413
16370
  */
16414
16371
 
16415
- NyanCat.prototype.cursorUp = function(n) {
16372
+ NyanCat.prototype.cursorUp = function (n) {
16416
16373
  write('\u001b[' + n + 'A');
16417
16374
  };
16418
16375
 
@@ -16423,7 +16380,7 @@
16423
16380
  * @param {number} n
16424
16381
  */
16425
16382
 
16426
- NyanCat.prototype.cursorDown = function(n) {
16383
+ NyanCat.prototype.cursorDown = function (n) {
16427
16384
  write('\u001b[' + n + 'B');
16428
16385
  };
16429
16386
 
@@ -16433,7 +16390,7 @@
16433
16390
  * @private
16434
16391
  * @return {Array}
16435
16392
  */
16436
- NyanCat.prototype.generateColors = function() {
16393
+ NyanCat.prototype.generateColors = function () {
16437
16394
  var colors = [];
16438
16395
 
16439
16396
  for (var i = 0; i < 6 * 7; i++) {
@@ -16455,7 +16412,7 @@
16455
16412
  * @param {string} str
16456
16413
  * @return {string}
16457
16414
  */
16458
- NyanCat.prototype.rainbowify = function(str) {
16415
+ NyanCat.prototype.rainbowify = function (str) {
16459
16416
  if (!base.useColors) {
16460
16417
  return str;
16461
16418
  }
@@ -16547,19 +16504,19 @@
16547
16504
  // fall back to the default suite name
16548
16505
  suiteName = suiteName || DEFAULT_SUITE_NAME;
16549
16506
 
16550
- runner.on(EVENT_TEST_PENDING, function(test) {
16507
+ runner.on(EVENT_TEST_PENDING, function (test) {
16551
16508
  tests.push(test);
16552
16509
  });
16553
16510
 
16554
- runner.on(EVENT_TEST_PASS, function(test) {
16511
+ runner.on(EVENT_TEST_PASS, function (test) {
16555
16512
  tests.push(test);
16556
16513
  });
16557
16514
 
16558
- runner.on(EVENT_TEST_FAIL, function(test) {
16515
+ runner.on(EVENT_TEST_FAIL, function (test) {
16559
16516
  tests.push(test);
16560
16517
  });
16561
16518
 
16562
- runner.once(EVENT_RUN_END, function() {
16519
+ runner.once(EVENT_RUN_END, function () {
16563
16520
  self.write(
16564
16521
  tag(
16565
16522
  'testsuite',
@@ -16576,7 +16533,7 @@
16576
16533
  )
16577
16534
  );
16578
16535
 
16579
- tests.forEach(function(t) {
16536
+ tests.forEach(function (t) {
16580
16537
  self.test(t);
16581
16538
  });
16582
16539
 
@@ -16595,9 +16552,9 @@
16595
16552
  * @param failures
16596
16553
  * @param {Function} fn
16597
16554
  */
16598
- XUnit.prototype.done = function(failures, fn) {
16555
+ XUnit.prototype.done = function (failures, fn) {
16599
16556
  if (this.fileStream) {
16600
- this.fileStream.end(function() {
16557
+ this.fileStream.end(function () {
16601
16558
  fn(failures);
16602
16559
  });
16603
16560
  } else {
@@ -16610,7 +16567,7 @@
16610
16567
  *
16611
16568
  * @param {string} line
16612
16569
  */
16613
- XUnit.prototype.write = function(line) {
16570
+ XUnit.prototype.write = function (line) {
16614
16571
  if (this.fileStream) {
16615
16572
  this.fileStream.write(line + '\n');
16616
16573
  } else if (typeof process$1 === 'object' && process$1.stdout) {
@@ -16625,7 +16582,7 @@
16625
16582
  *
16626
16583
  * @param {Test} test
16627
16584
  */
16628
- XUnit.prototype.test = function(test) {
16585
+ XUnit.prototype.test = function (test) {
16629
16586
  base.useColors = false;
16630
16587
 
16631
16588
  var attrs = {
@@ -16743,7 +16700,7 @@
16743
16700
  var key = SUITE_PREFIX + suite.title;
16744
16701
 
16745
16702
  obj = obj[key] = obj[key] || {suite: suite};
16746
- suite.suites.forEach(function(suite) {
16703
+ suite.suites.forEach(function (suite) {
16747
16704
  mapTOC(suite, obj);
16748
16705
  });
16749
16706
 
@@ -16775,18 +16732,18 @@
16775
16732
 
16776
16733
  generateTOC(runner.suite);
16777
16734
 
16778
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
16735
+ runner.on(EVENT_SUITE_BEGIN, function (suite) {
16779
16736
  ++level;
16780
16737
  var slug = utils.slug(suite.fullTitle());
16781
16738
  buf += '<a name="' + slug + '"></a>' + '\n';
16782
16739
  buf += title(suite.title) + '\n';
16783
16740
  });
16784
16741
 
16785
- runner.on(EVENT_SUITE_END, function() {
16742
+ runner.on(EVENT_SUITE_END, function () {
16786
16743
  --level;
16787
16744
  });
16788
16745
 
16789
- runner.on(EVENT_TEST_PASS, function(test) {
16746
+ runner.on(EVENT_TEST_PASS, function (test) {
16790
16747
  var code = utils.clean(test.body);
16791
16748
  buf += test.title + '.\n';
16792
16749
  buf += '\n```js\n';
@@ -16794,7 +16751,7 @@
16794
16751
  buf += '```\n\n';
16795
16752
  });
16796
16753
 
16797
- runner.once(EVENT_RUN_END, function() {
16754
+ runner.once(EVENT_RUN_END, function () {
16798
16755
  process$1.stdout.write('# TOC\n');
16799
16756
  process$1.stdout.write(generateTOC(runner.suite));
16800
16757
  process$1.stdout.write(buf);
@@ -16863,13 +16820,13 @@
16863
16820
  options.verbose = reporterOptions.verbose || false;
16864
16821
 
16865
16822
  // tests started
16866
- runner.on(EVENT_RUN_BEGIN, function() {
16823
+ runner.on(EVENT_RUN_BEGIN, function () {
16867
16824
  process$1.stdout.write('\n');
16868
16825
  cursor.hide();
16869
16826
  });
16870
16827
 
16871
16828
  // tests complete
16872
- runner.on(EVENT_TEST_END, function() {
16829
+ runner.on(EVENT_TEST_END, function () {
16873
16830
  complete++;
16874
16831
 
16875
16832
  var percent = complete / total;
@@ -16895,7 +16852,7 @@
16895
16852
 
16896
16853
  // tests are complete, output some stats
16897
16854
  // and the failures if any
16898
- runner.once(EVENT_RUN_END, function() {
16855
+ runner.once(EVENT_RUN_END, function () {
16899
16856
  cursor.show();
16900
16857
  process$1.stdout.write('\n');
16901
16858
  self.epilogue();
@@ -16980,12 +16937,12 @@
16980
16937
  return ' ' + color('runway', buf);
16981
16938
  }
16982
16939
 
16983
- runner.on(EVENT_RUN_BEGIN, function() {
16940
+ runner.on(EVENT_RUN_BEGIN, function () {
16984
16941
  stream.write('\n\n\n ');
16985
16942
  cursor.hide();
16986
16943
  });
16987
16944
 
16988
- runner.on(EVENT_TEST_END, function(test) {
16945
+ runner.on(EVENT_TEST_END, function (test) {
16989
16946
  // check if the plane crashed
16990
16947
  var col = crashed === -1 ? ((width * ++n) / ++total) | 0 : crashed;
16991
16948
  // show the crash
@@ -17005,16 +16962,16 @@
17005
16962
  stream.write('\u001b[0m');
17006
16963
  });
17007
16964
 
17008
- runner.once(EVENT_RUN_END, function() {
16965
+ runner.once(EVENT_RUN_END, function () {
17009
16966
  cursor.show();
17010
16967
  process$1.stdout.write('\n');
17011
16968
  self.epilogue();
17012
16969
  });
17013
16970
 
17014
16971
  // if cursor is hidden when we ctrl-C, then it will remain hidden unless...
17015
- process$1.once('SIGINT', function() {
16972
+ process$1.once('SIGINT', function () {
17016
16973
  cursor.show();
17017
- nextTick$1(function() {
16974
+ nextTick$1(function () {
17018
16975
  process$1.kill(process$1.pid, 'SIGINT');
17019
16976
  });
17020
16977
  });
@@ -17065,22 +17022,22 @@
17065
17022
  var self = this;
17066
17023
  var total = runner.total;
17067
17024
 
17068
- runner.once(EVENT_RUN_BEGIN, function() {
17025
+ runner.once(EVENT_RUN_BEGIN, function () {
17069
17026
  writeEvent(['start', {total: total}]);
17070
17027
  });
17071
17028
 
17072
- runner.on(EVENT_TEST_PASS, function(test) {
17029
+ runner.on(EVENT_TEST_PASS, function (test) {
17073
17030
  writeEvent(['pass', clean(test)]);
17074
17031
  });
17075
17032
 
17076
- runner.on(EVENT_TEST_FAIL, function(test, err) {
17033
+ runner.on(EVENT_TEST_FAIL, function (test, err) {
17077
17034
  test = clean(test);
17078
17035
  test.err = err.message;
17079
17036
  test.stack = err.stack || null;
17080
17037
  writeEvent(['fail', test]);
17081
17038
  });
17082
17039
 
17083
- runner.once(EVENT_RUN_END, function() {
17040
+ runner.once(EVENT_RUN_END, function () {
17084
17041
  writeEvent(['end', self.stats]);
17085
17042
  });
17086
17043
  }
@@ -17144,7 +17101,7 @@
17144
17101
  });
17145
17102
 
17146
17103
  var name = "mocha";
17147
- var version = "9.1.0";
17104
+ var version = "9.1.4";
17148
17105
  var homepage = "https://mochajs.org/";
17149
17106
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
17150
17107
  var _package = {
@@ -17163,7 +17120,7 @@
17163
17120
  'default': _package
17164
17121
  });
17165
17122
 
17166
- var require$$10 = getCjsExportFromNamespace(_package$1);
17123
+ var require$$9 = getCjsExportFromNamespace(_package$1);
17167
17124
 
17168
17125
  /**
17169
17126
  * Web Notifications module.
@@ -17188,7 +17145,7 @@
17188
17145
  * @see {@link Mocha#isGrowlCapable}
17189
17146
  * @return {boolean} whether browser notification support exists
17190
17147
  */
17191
- var isCapable = function() {
17148
+ var isCapable = function () {
17192
17149
  var hasNotificationSupport = 'Notification' in window;
17193
17150
  var hasPromiseSupport = typeof Promise === 'function';
17194
17151
  return isBrowser() && hasNotificationSupport && hasPromiseSupport;
@@ -17204,17 +17161,17 @@
17204
17161
  * @see {@link Mocha#_growl}
17205
17162
  * @param {Runner} runner - Runner instance.
17206
17163
  */
17207
- var notify = function(runner) {
17164
+ var notify = function (runner) {
17208
17165
  var promise = isPermitted();
17209
17166
 
17210
17167
  /**
17211
17168
  * Attempt notification.
17212
17169
  */
17213
- var sendNotification = function() {
17170
+ var sendNotification = function () {
17214
17171
  // If user hasn't responded yet... "No notification for you!" (Seinfeld)
17215
17172
  Promise.race([promise, Promise.resolve(undefined)])
17216
17173
  .then(canNotify)
17217
- .then(function() {
17174
+ .then(function () {
17218
17175
  display(runner);
17219
17176
  })
17220
17177
  .catch(notPermitted);
@@ -17242,7 +17199,7 @@
17242
17199
  return Promise.resolve(false);
17243
17200
  },
17244
17201
  default: function ask() {
17245
- return Notification.requestPermission().then(function(permission) {
17202
+ return Notification.requestPermission().then(function (permission) {
17246
17203
  return permission === 'granted';
17247
17204
  });
17248
17205
  }
@@ -17290,7 +17247,7 @@
17290
17247
  cross: '\u274C',
17291
17248
  tick: '\u2705'
17292
17249
  };
17293
- var logo = require$$10.notifyLogo;
17250
+ var logo = require$$9.notifyLogo;
17294
17251
  var _message;
17295
17252
  var message;
17296
17253
  var title;
@@ -17429,25 +17386,25 @@
17429
17386
 
17430
17387
  runner.stats = stats;
17431
17388
 
17432
- runner.once(EVENT_RUN_BEGIN, function() {
17389
+ runner.once(EVENT_RUN_BEGIN, function () {
17433
17390
  stats.start = new Date$2();
17434
17391
  });
17435
- runner.on(EVENT_SUITE_BEGIN, function(suite) {
17392
+ runner.on(EVENT_SUITE_BEGIN, function (suite) {
17436
17393
  suite.root || stats.suites++;
17437
17394
  });
17438
- runner.on(EVENT_TEST_PASS, function() {
17395
+ runner.on(EVENT_TEST_PASS, function () {
17439
17396
  stats.passes++;
17440
17397
  });
17441
- runner.on(EVENT_TEST_FAIL, function() {
17398
+ runner.on(EVENT_TEST_FAIL, function () {
17442
17399
  stats.failures++;
17443
17400
  });
17444
- runner.on(EVENT_TEST_PENDING, function() {
17401
+ runner.on(EVENT_TEST_PENDING, function () {
17445
17402
  stats.pending++;
17446
17403
  });
17447
- runner.on(EVENT_TEST_END, function() {
17404
+ runner.on(EVENT_TEST_END, function () {
17448
17405
  stats.tests++;
17449
17406
  });
17450
- runner.once(EVENT_RUN_END, function() {
17407
+ runner.once(EVENT_RUN_END, function () {
17451
17408
  stats.end = new Date$2();
17452
17409
  stats.duration = stats.end - stats.start;
17453
17410
  });
@@ -17494,7 +17451,7 @@
17494
17451
  /**
17495
17452
  * Resets the state initially or for a next run.
17496
17453
  */
17497
- Test.prototype.reset = function() {
17454
+ Test.prototype.reset = function () {
17498
17455
  runnable.prototype.reset.call(this);
17499
17456
  this.pending = !this.fn;
17500
17457
  delete this.state;
@@ -17505,7 +17462,7 @@
17505
17462
  *
17506
17463
  * @private
17507
17464
  */
17508
- Test.prototype.retriedTest = function(n) {
17465
+ Test.prototype.retriedTest = function (n) {
17509
17466
  if (!arguments.length) {
17510
17467
  return this._retriedTest;
17511
17468
  }
@@ -17517,11 +17474,11 @@
17517
17474
  *
17518
17475
  * @private
17519
17476
  */
17520
- Test.prototype.markOnly = function() {
17477
+ Test.prototype.markOnly = function () {
17521
17478
  this.parent.appendOnlyTest(this);
17522
17479
  };
17523
17480
 
17524
- Test.prototype.clone = function() {
17481
+ Test.prototype.clone = function () {
17525
17482
  var test = new Test(this.title, this.fn);
17526
17483
  test.timeout(this.timeout());
17527
17484
  test.slow(this.slow());
@@ -17545,7 +17502,7 @@
17545
17502
  return {
17546
17503
  $$currentRetry: this._currentRetry,
17547
17504
  $$fullTitle: this.fullTitle(),
17548
- $$isPending: this.pending,
17505
+ $$isPending: Boolean(this.pending),
17549
17506
  $$retriedTest: this._retriedTest || null,
17550
17507
  $$slow: this._slow,
17551
17508
  $$titlePath: this.titlePath(),
@@ -17584,7 +17541,7 @@
17584
17541
  * @param {Mocha} mocha
17585
17542
  * @return {Object} An object containing common functions.
17586
17543
  */
17587
- var common = function(suites, context, mocha) {
17544
+ var common = function (suites, context, mocha) {
17588
17545
  /**
17589
17546
  * Check if the suite should be tested.
17590
17547
  *
@@ -17621,7 +17578,7 @@
17621
17578
  * @param {string} name
17622
17579
  * @param {Function} fn
17623
17580
  */
17624
- before: function(name, fn) {
17581
+ before: function (name, fn) {
17625
17582
  suites[0].beforeAll(name, fn);
17626
17583
  },
17627
17584
 
@@ -17631,7 +17588,7 @@
17631
17588
  * @param {string} name
17632
17589
  * @param {Function} fn
17633
17590
  */
17634
- after: function(name, fn) {
17591
+ after: function (name, fn) {
17635
17592
  suites[0].afterAll(name, fn);
17636
17593
  },
17637
17594
 
@@ -17641,7 +17598,7 @@
17641
17598
  * @param {string} name
17642
17599
  * @param {Function} fn
17643
17600
  */
17644
- beforeEach: function(name, fn) {
17601
+ beforeEach: function (name, fn) {
17645
17602
  suites[0].beforeEach(name, fn);
17646
17603
  },
17647
17604
 
@@ -17651,7 +17608,7 @@
17651
17608
  * @param {string} name
17652
17609
  * @param {Function} fn
17653
17610
  */
17654
- afterEach: function(name, fn) {
17611
+ afterEach: function (name, fn) {
17655
17612
  suites[0].afterEach(name, fn);
17656
17613
  },
17657
17614
 
@@ -17737,7 +17694,7 @@
17737
17694
  * @param {Function} test
17738
17695
  * @returns {*}
17739
17696
  */
17740
- only: function(mocha, test) {
17697
+ only: function (mocha, test) {
17741
17698
  if (mocha.options.forbidOnly) {
17742
17699
  throw createForbiddenExclusivityError(mocha);
17743
17700
  }
@@ -17750,15 +17707,15 @@
17750
17707
  *
17751
17708
  * @param {string} title
17752
17709
  */
17753
- skip: function(title) {
17710
+ skip: function (title) {
17754
17711
  context.test(title);
17755
17712
  }
17756
17713
  }
17757
17714
  };
17758
17715
  };
17759
17716
 
17760
- var EVENT_FILE_PRE_REQUIRE$2 = suite.constants
17761
- .EVENT_FILE_PRE_REQUIRE;
17717
+ var EVENT_FILE_PRE_REQUIRE$2 =
17718
+ suite.constants.EVENT_FILE_PRE_REQUIRE;
17762
17719
 
17763
17720
  /**
17764
17721
  * BDD-style interface:
@@ -17780,7 +17737,7 @@
17780
17737
  var bdd$1 = function bddInterface(suite) {
17781
17738
  var suites = [suite];
17782
17739
 
17783
- suite.on(EVENT_FILE_PRE_REQUIRE$2, function(context, file, mocha) {
17740
+ suite.on(EVENT_FILE_PRE_REQUIRE$2, function (context, file, mocha) {
17784
17741
  var common$1 = common(suites, context, mocha);
17785
17742
 
17786
17743
  context.before = common$1.before;
@@ -17794,7 +17751,7 @@
17794
17751
  * and/or tests.
17795
17752
  */
17796
17753
 
17797
- context.describe = context.context = function(title, fn) {
17754
+ context.describe = context.context = function (title, fn) {
17798
17755
  return common$1.suite.create({
17799
17756
  title: title,
17800
17757
  file: file,
@@ -17806,22 +17763,22 @@
17806
17763
  * Pending describe.
17807
17764
  */
17808
17765
 
17809
- context.xdescribe = context.xcontext = context.describe.skip = function(
17810
- title,
17811
- fn
17812
- ) {
17813
- return common$1.suite.skip({
17814
- title: title,
17815
- file: file,
17816
- fn: fn
17817
- });
17818
- };
17766
+ context.xdescribe =
17767
+ context.xcontext =
17768
+ context.describe.skip =
17769
+ function (title, fn) {
17770
+ return common$1.suite.skip({
17771
+ title: title,
17772
+ file: file,
17773
+ fn: fn
17774
+ });
17775
+ };
17819
17776
 
17820
17777
  /**
17821
17778
  * Exclusive suite.
17822
17779
  */
17823
17780
 
17824
- context.describe.only = function(title, fn) {
17781
+ context.describe.only = function (title, fn) {
17825
17782
  return common$1.suite.only({
17826
17783
  title: title,
17827
17784
  file: file,
@@ -17835,7 +17792,7 @@
17835
17792
  * acting as a thunk.
17836
17793
  */
17837
17794
 
17838
- context.it = context.specify = function(title, fn) {
17795
+ context.it = context.specify = function (title, fn) {
17839
17796
  var suite = suites[0];
17840
17797
  if (suite.isPending()) {
17841
17798
  fn = null;
@@ -17850,7 +17807,7 @@
17850
17807
  * Exclusive test-case.
17851
17808
  */
17852
17809
 
17853
- context.it.only = function(title, fn) {
17810
+ context.it.only = function (title, fn) {
17854
17811
  return common$1.test.only(mocha, context.it(title, fn));
17855
17812
  };
17856
17813
 
@@ -17858,17 +17815,20 @@
17858
17815
  * Pending test case.
17859
17816
  */
17860
17817
 
17861
- context.xit = context.xspecify = context.it.skip = function(title) {
17862
- return context.it(title);
17863
- };
17818
+ context.xit =
17819
+ context.xspecify =
17820
+ context.it.skip =
17821
+ function (title) {
17822
+ return context.it(title);
17823
+ };
17864
17824
  });
17865
17825
  };
17866
17826
 
17867
17827
  var description$3 = 'BDD or RSpec style [default]';
17868
17828
  bdd$1.description = description$3;
17869
17829
 
17870
- var EVENT_FILE_PRE_REQUIRE$1 = suite.constants
17871
- .EVENT_FILE_PRE_REQUIRE;
17830
+ var EVENT_FILE_PRE_REQUIRE$1 =
17831
+ suite.constants.EVENT_FILE_PRE_REQUIRE;
17872
17832
 
17873
17833
  /**
17874
17834
  * TDD-style interface:
@@ -17895,10 +17855,10 @@
17895
17855
  *
17896
17856
  * @param {Suite} suite Root suite.
17897
17857
  */
17898
- var tdd$1 = function(suite) {
17858
+ var tdd$1 = function (suite) {
17899
17859
  var suites = [suite];
17900
17860
 
17901
- suite.on(EVENT_FILE_PRE_REQUIRE$1, function(context, file, mocha) {
17861
+ suite.on(EVENT_FILE_PRE_REQUIRE$1, function (context, file, mocha) {
17902
17862
  var common$1 = common(suites, context, mocha);
17903
17863
 
17904
17864
  context.setup = common$1.beforeEach;
@@ -17911,7 +17871,7 @@
17911
17871
  * Describe a "suite" with the given `title` and callback `fn` containing
17912
17872
  * nested suites and/or tests.
17913
17873
  */
17914
- context.suite = function(title, fn) {
17874
+ context.suite = function (title, fn) {
17915
17875
  return common$1.suite.create({
17916
17876
  title: title,
17917
17877
  file: file,
@@ -17922,7 +17882,7 @@
17922
17882
  /**
17923
17883
  * Pending suite.
17924
17884
  */
17925
- context.suite.skip = function(title, fn) {
17885
+ context.suite.skip = function (title, fn) {
17926
17886
  return common$1.suite.skip({
17927
17887
  title: title,
17928
17888
  file: file,
@@ -17933,7 +17893,7 @@
17933
17893
  /**
17934
17894
  * Exclusive test-case.
17935
17895
  */
17936
- context.suite.only = function(title, fn) {
17896
+ context.suite.only = function (title, fn) {
17937
17897
  return common$1.suite.only({
17938
17898
  title: title,
17939
17899
  file: file,
@@ -17945,7 +17905,7 @@
17945
17905
  * Describe a specification or test-case with the given `title` and
17946
17906
  * callback `fn` acting as a thunk.
17947
17907
  */
17948
- context.test = function(title, fn) {
17908
+ context.test = function (title, fn) {
17949
17909
  var suite = suites[0];
17950
17910
  if (suite.isPending()) {
17951
17911
  fn = null;
@@ -17960,7 +17920,7 @@
17960
17920
  * Exclusive test-case.
17961
17921
  */
17962
17922
 
17963
- context.test.only = function(title, fn) {
17923
+ context.test.only = function (title, fn) {
17964
17924
  return common$1.test.only(mocha, context.test(title, fn));
17965
17925
  };
17966
17926
 
@@ -17972,8 +17932,8 @@
17972
17932
  'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
17973
17933
  tdd$1.description = description$2;
17974
17934
 
17975
- var EVENT_FILE_PRE_REQUIRE = suite.constants
17976
- .EVENT_FILE_PRE_REQUIRE;
17935
+ var EVENT_FILE_PRE_REQUIRE =
17936
+ suite.constants.EVENT_FILE_PRE_REQUIRE;
17977
17937
 
17978
17938
  /**
17979
17939
  * QUnit-style interface:
@@ -18003,7 +17963,7 @@
18003
17963
  var qunit$1 = function qUnitInterface(suite) {
18004
17964
  var suites = [suite];
18005
17965
 
18006
- suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
17966
+ suite.on(EVENT_FILE_PRE_REQUIRE, function (context, file, mocha) {
18007
17967
  var common$1 = common(suites, context, mocha);
18008
17968
 
18009
17969
  context.before = common$1.before;
@@ -18015,7 +17975,7 @@
18015
17975
  * Describe a "suite" with the given `title`.
18016
17976
  */
18017
17977
 
18018
- context.suite = function(title) {
17978
+ context.suite = function (title) {
18019
17979
  if (suites.length > 1) {
18020
17980
  suites.shift();
18021
17981
  }
@@ -18030,7 +17990,7 @@
18030
17990
  * Exclusive Suite.
18031
17991
  */
18032
17992
 
18033
- context.suite.only = function(title) {
17993
+ context.suite.only = function (title) {
18034
17994
  if (suites.length > 1) {
18035
17995
  suites.shift();
18036
17996
  }
@@ -18047,7 +18007,7 @@
18047
18007
  * acting as a thunk.
18048
18008
  */
18049
18009
 
18050
- context.test = function(title, fn) {
18010
+ context.test = function (title, fn) {
18051
18011
  var test$1 = new test(title, fn);
18052
18012
  test$1.file = file;
18053
18013
  suites[0].addTest(test$1);
@@ -18058,7 +18018,7 @@
18058
18018
  * Exclusive test-case.
18059
18019
  */
18060
18020
 
18061
- context.test.only = function(title, fn) {
18021
+ context.test.only = function (title, fn) {
18062
18022
  return common$1.test.only(mocha, context.test(title, fn));
18063
18023
  };
18064
18024
 
@@ -18086,7 +18046,7 @@
18086
18046
  *
18087
18047
  * @param {Suite} suite Root suite.
18088
18048
  */
18089
- var exports$2 = function(suite$1) {
18049
+ var exports$2 = function (suite$1) {
18090
18050
  var suites = [suite$1];
18091
18051
 
18092
18052
  suite$1.on(suite.constants.EVENT_FILE_REQUIRE, visit);
@@ -18162,7 +18122,7 @@
18162
18122
  * @param {Runnable} runnable
18163
18123
  * @return {Context} context
18164
18124
  */
18165
- Context.prototype.runnable = function(runnable) {
18125
+ Context.prototype.runnable = function (runnable) {
18166
18126
  if (!arguments.length) {
18167
18127
  return this._runnable;
18168
18128
  }
@@ -18177,7 +18137,7 @@
18177
18137
  * @param {number} ms
18178
18138
  * @return {Context} self
18179
18139
  */
18180
- Context.prototype.timeout = function(ms) {
18140
+ Context.prototype.timeout = function (ms) {
18181
18141
  if (!arguments.length) {
18182
18142
  return this.runnable().timeout();
18183
18143
  }
@@ -18192,7 +18152,7 @@
18192
18152
  * @param {number} ms
18193
18153
  * @return {Context} self
18194
18154
  */
18195
- Context.prototype.slow = function(ms) {
18155
+ Context.prototype.slow = function (ms) {
18196
18156
  if (!arguments.length) {
18197
18157
  return this.runnable().slow();
18198
18158
  }
@@ -18206,7 +18166,7 @@
18206
18166
  * @private
18207
18167
  * @throws Pending
18208
18168
  */
18209
- Context.prototype.skip = function() {
18169
+ Context.prototype.skip = function () {
18210
18170
  this.runnable().skip();
18211
18171
  };
18212
18172
 
@@ -18217,7 +18177,7 @@
18217
18177
  * @param {number} n
18218
18178
  * @return {Context} self
18219
18179
  */
18220
- Context.prototype.retries = function(n) {
18180
+ Context.prototype.retries = function (n) {
18221
18181
  if (!arguments.length) {
18222
18182
  return this.runnable().retries();
18223
18183
  }
@@ -18242,9 +18202,7 @@
18242
18202
 
18243
18203
 
18244
18204
 
18245
- var esmUtils = utils.supportsEsModules(true)
18246
- ? require$$11
18247
- : undefined;
18205
+
18248
18206
 
18249
18207
  const {
18250
18208
  warn,
@@ -18254,11 +18212,8 @@
18254
18212
  createMochaInstanceAlreadyRunningError,
18255
18213
  createUnsupportedError
18256
18214
  } = errors;
18257
- const {
18258
- EVENT_FILE_PRE_REQUIRE,
18259
- EVENT_FILE_POST_REQUIRE,
18260
- EVENT_FILE_REQUIRE
18261
- } = suite.constants;
18215
+ const {EVENT_FILE_PRE_REQUIRE, EVENT_FILE_POST_REQUIRE, EVENT_FILE_REQUIRE} =
18216
+ suite.constants;
18262
18217
  var debug = browser('mocha:mocha');
18263
18218
 
18264
18219
  exports = module.exports = Mocha;
@@ -18325,46 +18280,46 @@
18325
18280
  exports.Test = test;
18326
18281
 
18327
18282
  let currentContext;
18328
- exports.afterEach = function(...args) {
18283
+ exports.afterEach = function (...args) {
18329
18284
  return (currentContext.afterEach || currentContext.teardown).apply(
18330
18285
  this,
18331
18286
  args
18332
18287
  );
18333
18288
  };
18334
- exports.after = function(...args) {
18289
+ exports.after = function (...args) {
18335
18290
  return (currentContext.after || currentContext.suiteTeardown).apply(
18336
18291
  this,
18337
18292
  args
18338
18293
  );
18339
18294
  };
18340
- exports.beforeEach = function(...args) {
18295
+ exports.beforeEach = function (...args) {
18341
18296
  return (currentContext.beforeEach || currentContext.setup).apply(this, args);
18342
18297
  };
18343
- exports.before = function(...args) {
18298
+ exports.before = function (...args) {
18344
18299
  return (currentContext.before || currentContext.suiteSetup).apply(this, args);
18345
18300
  };
18346
- exports.describe = function(...args) {
18301
+ exports.describe = function (...args) {
18347
18302
  return (currentContext.describe || currentContext.suite).apply(this, args);
18348
18303
  };
18349
- exports.describe.only = function(...args) {
18304
+ exports.describe.only = function (...args) {
18350
18305
  return (currentContext.describe || currentContext.suite).only.apply(
18351
18306
  this,
18352
18307
  args
18353
18308
  );
18354
18309
  };
18355
- exports.describe.skip = function(...args) {
18310
+ exports.describe.skip = function (...args) {
18356
18311
  return (currentContext.describe || currentContext.suite).skip.apply(
18357
18312
  this,
18358
18313
  args
18359
18314
  );
18360
18315
  };
18361
- exports.it = function(...args) {
18316
+ exports.it = function (...args) {
18362
18317
  return (currentContext.it || currentContext.test).apply(this, args);
18363
18318
  };
18364
- exports.it.only = function(...args) {
18319
+ exports.it.only = function (...args) {
18365
18320
  return (currentContext.it || currentContext.test).only.apply(this, args);
18366
18321
  };
18367
- exports.it.skip = function(...args) {
18322
+ exports.it.skip = function (...args) {
18368
18323
  return (currentContext.it || currentContext.test).skip.apply(this, args);
18369
18324
  };
18370
18325
  exports.xdescribe = exports.describe.skip;
@@ -18375,7 +18330,7 @@
18375
18330
  exports.suite = exports.describe;
18376
18331
  exports.teardown = exports.afterEach;
18377
18332
  exports.test = exports.it;
18378
- exports.run = function(...args) {
18333
+ exports.run = function (...args) {
18379
18334
  return currentContext.run.apply(this, args);
18380
18335
  };
18381
18336
 
@@ -18460,7 +18415,7 @@
18460
18415
  'growl',
18461
18416
  'inlineDiffs',
18462
18417
  'invert'
18463
- ].forEach(function(opt) {
18418
+ ].forEach(function (opt) {
18464
18419
  if (options[opt]) {
18465
18420
  this[opt]();
18466
18421
  }
@@ -18518,7 +18473,7 @@
18518
18473
  * @returns {Mocha} this
18519
18474
  * @chainable
18520
18475
  */
18521
- Mocha.prototype.bail = function(bail) {
18476
+ Mocha.prototype.bail = function (bail) {
18522
18477
  this.suite.bail(bail !== false);
18523
18478
  return this;
18524
18479
  };
@@ -18536,7 +18491,7 @@
18536
18491
  * @returns {Mocha} this
18537
18492
  * @chainable
18538
18493
  */
18539
- Mocha.prototype.addFile = function(file) {
18494
+ Mocha.prototype.addFile = function (file) {
18540
18495
  this.files.push(file);
18541
18496
  return this;
18542
18497
  };
@@ -18557,7 +18512,7 @@
18557
18512
  * // Use XUnit reporter and direct its output to file
18558
18513
  * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
18559
18514
  */
18560
- Mocha.prototype.reporter = function(reporterName, reporterOptions) {
18515
+ Mocha.prototype.reporter = function (reporterName, reporterOptions) {
18561
18516
  if (typeof reporterName === 'function') {
18562
18517
  this._reporter = reporterName;
18563
18518
  } else {
@@ -18613,7 +18568,7 @@
18613
18568
  * @chainable
18614
18569
  * @throws {Error} if requested interface cannot be loaded
18615
18570
  */
18616
- Mocha.prototype.ui = function(ui) {
18571
+ Mocha.prototype.ui = function (ui) {
18617
18572
  var bindInterface;
18618
18573
  if (typeof ui === 'function') {
18619
18574
  bindInterface = ui;
@@ -18630,7 +18585,7 @@
18630
18585
  }
18631
18586
  bindInterface(this.suite);
18632
18587
 
18633
- this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
18588
+ this.suite.on(EVENT_FILE_PRE_REQUIRE, function (context) {
18634
18589
  currentContext = context;
18635
18590
  });
18636
18591
 
@@ -18652,10 +18607,10 @@
18652
18607
  * @see {@link Mocha#loadFilesAsync}
18653
18608
  * @param {Function} [fn] - Callback invoked upon completion.
18654
18609
  */
18655
- Mocha.prototype.loadFiles = function(fn) {
18610
+ Mocha.prototype.loadFiles = function (fn) {
18656
18611
  var self = this;
18657
18612
  var suite = this.suite;
18658
- this.files.forEach(function(file) {
18613
+ this.files.forEach(function (file) {
18659
18614
  file = path.resolve(file);
18660
18615
  suite.emit(EVENT_FILE_PRE_REQUIRE, commonjsGlobal, file, self);
18661
18616
  suite.emit(EVENT_FILE_REQUIRE, commonjsRequire(), file, self);
@@ -18684,23 +18639,17 @@
18684
18639
  * .then(() => mocha.run(failures => process.exitCode = failures ? 1 : 0))
18685
18640
  * .catch(() => process.exitCode = 1);
18686
18641
  */
18687
- Mocha.prototype.loadFilesAsync = function() {
18642
+ Mocha.prototype.loadFilesAsync = function () {
18688
18643
  var self = this;
18689
18644
  var suite = this.suite;
18690
18645
  this.lazyLoadFiles(true);
18691
18646
 
18692
- if (!esmUtils) {
18693
- return new Promise(function(resolve) {
18694
- self.loadFiles(resolve);
18695
- });
18696
- }
18697
-
18698
- return esmUtils.loadFilesAsync(
18647
+ return require$$10.loadFilesAsync(
18699
18648
  this.files,
18700
- function(file) {
18649
+ function (file) {
18701
18650
  suite.emit(EVENT_FILE_PRE_REQUIRE, commonjsGlobal, file, self);
18702
18651
  },
18703
- function(file, resultModule) {
18652
+ function (file, resultModule) {
18704
18653
  suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
18705
18654
  suite.emit(EVENT_FILE_POST_REQUIRE, commonjsGlobal, file, self);
18706
18655
  }
@@ -18715,13 +18664,13 @@
18715
18664
  * @see {@link Mocha#unloadFiles}
18716
18665
  * @param {string} file - Pathname of file to be unloaded.
18717
18666
  */
18718
- Mocha.unloadFile = function(file) {
18667
+ Mocha.unloadFile = function (file) {
18719
18668
  if (utils.isBrowser()) {
18720
18669
  throw createUnsupportedError(
18721
18670
  'unloadFile() is only suported in a Node.js environment'
18722
18671
  );
18723
18672
  }
18724
- return require$$11.unloadFile(file);
18673
+ return require$$10.unloadFile(file);
18725
18674
  };
18726
18675
 
18727
18676
  /**
@@ -18739,7 +18688,7 @@
18739
18688
  * @returns {Mocha} this
18740
18689
  * @chainable
18741
18690
  */
18742
- Mocha.prototype.unloadFiles = function() {
18691
+ Mocha.prototype.unloadFiles = function () {
18743
18692
  if (this._state === mochaStates.DISPOSED) {
18744
18693
  throw createMochaInstanceAlreadyDisposedError(
18745
18694
  'Mocha instance is already disposed, it cannot be used again.',
@@ -18748,7 +18697,7 @@
18748
18697
  );
18749
18698
  }
18750
18699
 
18751
- this.files.forEach(function(file) {
18700
+ this.files.forEach(function (file) {
18752
18701
  Mocha.unloadFile(file);
18753
18702
  });
18754
18703
  this._state = mochaStates.INIT;
@@ -18768,7 +18717,7 @@
18768
18717
  * // Select tests whose full title begins with `"foo"` followed by a period
18769
18718
  * mocha.fgrep('foo.');
18770
18719
  */
18771
- Mocha.prototype.fgrep = function(str) {
18720
+ Mocha.prototype.fgrep = function (str) {
18772
18721
  if (!str) {
18773
18722
  return this;
18774
18723
  }
@@ -18809,7 +18758,7 @@
18809
18758
  * // Given embedded test `it('only-this-test')`...
18810
18759
  * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
18811
18760
  */
18812
- Mocha.prototype.grep = function(re) {
18761
+ Mocha.prototype.grep = function (re) {
18813
18762
  if (utils.isString(re)) {
18814
18763
  // extract args if it's regex-like, i.e: [string, pattern, flag]
18815
18764
  var arg = re.match(/^\/(.*)\/([gimy]{0,4})$|.*/);
@@ -18832,7 +18781,7 @@
18832
18781
  * // Select tests whose full title does *not* contain `"match"`, ignoring case
18833
18782
  * mocha.grep(/match/i).invert();
18834
18783
  */
18835
- Mocha.prototype.invert = function() {
18784
+ Mocha.prototype.invert = function () {
18836
18785
  this.options.invert = true;
18837
18786
  return this;
18838
18787
  };
@@ -18846,7 +18795,7 @@
18846
18795
  * @return {Mocha} this
18847
18796
  * @chainable
18848
18797
  */
18849
- Mocha.prototype.checkLeaks = function(checkLeaks) {
18798
+ Mocha.prototype.checkLeaks = function (checkLeaks) {
18850
18799
  this.options.checkLeaks = checkLeaks !== false;
18851
18800
  return this;
18852
18801
  };
@@ -18861,7 +18810,7 @@
18861
18810
  * @return {Mocha} this
18862
18811
  * @chainable
18863
18812
  */
18864
- Mocha.prototype.cleanReferencesAfterRun = function(cleanReferencesAfterRun) {
18813
+ Mocha.prototype.cleanReferencesAfterRun = function (cleanReferencesAfterRun) {
18865
18814
  this._cleanReferencesAfterRun = cleanReferencesAfterRun !== false;
18866
18815
  return this;
18867
18816
  };
@@ -18871,7 +18820,7 @@
18871
18820
  * It also removes function references to tests functions and hooks, so variables trapped in closures can be cleaned by the garbage collector.
18872
18821
  * @public
18873
18822
  */
18874
- Mocha.prototype.dispose = function() {
18823
+ Mocha.prototype.dispose = function () {
18875
18824
  if (this._state === mochaStates.RUNNING) {
18876
18825
  throw createMochaInstanceAlreadyRunningError(
18877
18826
  'Cannot dispose while the mocha instance is still running tests.'
@@ -18892,7 +18841,7 @@
18892
18841
  * @return {Mocha} this
18893
18842
  * @chainable
18894
18843
  */
18895
- Mocha.prototype.fullTrace = function(fullTrace) {
18844
+ Mocha.prototype.fullTrace = function (fullTrace) {
18896
18845
  this.options.fullTrace = fullTrace !== false;
18897
18846
  return this;
18898
18847
  };
@@ -18905,7 +18854,7 @@
18905
18854
  * @return {Mocha} this
18906
18855
  * @chainable
18907
18856
  */
18908
- Mocha.prototype.growl = function() {
18857
+ Mocha.prototype.growl = function () {
18909
18858
  this.options.growl = this.isGrowlCapable();
18910
18859
  if (!this.options.growl) {
18911
18860
  var detail = utils.isBrowser()
@@ -18954,11 +18903,11 @@
18954
18903
  * // Specify variables to be expected in global scope
18955
18904
  * mocha.global(['jQuery', 'MyLib']);
18956
18905
  */
18957
- Mocha.prototype.global = function(global) {
18906
+ Mocha.prototype.global = function (global) {
18958
18907
  this.options.global = (this.options.global || [])
18959
18908
  .concat(global)
18960
18909
  .filter(Boolean)
18961
- .filter(function(elt, idx, arr) {
18910
+ .filter(function (elt, idx, arr) {
18962
18911
  return arr.indexOf(elt) === idx;
18963
18912
  });
18964
18913
  return this;
@@ -18975,7 +18924,7 @@
18975
18924
  * @return {Mocha} this
18976
18925
  * @chainable
18977
18926
  */
18978
- Mocha.prototype.color = function(color) {
18927
+ Mocha.prototype.color = function (color) {
18979
18928
  this.options.color = color !== false;
18980
18929
  return this;
18981
18930
  };
@@ -18990,7 +18939,7 @@
18990
18939
  * @return {Mocha} this
18991
18940
  * @chainable
18992
18941
  */
18993
- Mocha.prototype.inlineDiffs = function(inlineDiffs) {
18942
+ Mocha.prototype.inlineDiffs = function (inlineDiffs) {
18994
18943
  this.options.inlineDiffs = inlineDiffs !== false;
18995
18944
  return this;
18996
18945
  };
@@ -19004,7 +18953,7 @@
19004
18953
  * @return {Mocha} this
19005
18954
  * @chainable
19006
18955
  */
19007
- Mocha.prototype.diff = function(diff) {
18956
+ Mocha.prototype.diff = function (diff) {
19008
18957
  this.options.diff = diff !== false;
19009
18958
  return this;
19010
18959
  };
@@ -19032,7 +18981,7 @@
19032
18981
  * // Same as above but using string argument
19033
18982
  * mocha.timeout('1s');
19034
18983
  */
19035
- Mocha.prototype.timeout = function(msecs) {
18984
+ Mocha.prototype.timeout = function (msecs) {
19036
18985
  this.suite.timeout(msecs);
19037
18986
  return this;
19038
18987
  };
@@ -19051,7 +19000,7 @@
19051
19000
  * // Allow any failed test to retry one more time
19052
19001
  * mocha.retries(1);
19053
19002
  */
19054
- Mocha.prototype.retries = function(retry) {
19003
+ Mocha.prototype.retries = function (retry) {
19055
19004
  this.suite.retries(retry);
19056
19005
  return this;
19057
19006
  };
@@ -19073,7 +19022,7 @@
19073
19022
  * // Same as above but using string argument
19074
19023
  * mocha.slow('0.5s');
19075
19024
  */
19076
- Mocha.prototype.slow = function(msecs) {
19025
+ Mocha.prototype.slow = function (msecs) {
19077
19026
  this.suite.slow(msecs);
19078
19027
  return this;
19079
19028
  };
@@ -19087,7 +19036,7 @@
19087
19036
  * @return {Mocha} this
19088
19037
  * @chainable
19089
19038
  */
19090
- Mocha.prototype.asyncOnly = function(asyncOnly) {
19039
+ Mocha.prototype.asyncOnly = function (asyncOnly) {
19091
19040
  this.options.asyncOnly = asyncOnly !== false;
19092
19041
  return this;
19093
19042
  };
@@ -19099,7 +19048,7 @@
19099
19048
  * @return {Mocha} this
19100
19049
  * @chainable
19101
19050
  */
19102
- Mocha.prototype.noHighlighting = function() {
19051
+ Mocha.prototype.noHighlighting = function () {
19103
19052
  this.options.noHighlighting = true;
19104
19053
  return this;
19105
19054
  };
@@ -19113,7 +19062,7 @@
19113
19062
  * @return {Mocha} this
19114
19063
  * @chainable
19115
19064
  */
19116
- Mocha.prototype.allowUncaught = function(allowUncaught) {
19065
+ Mocha.prototype.allowUncaught = function (allowUncaught) {
19117
19066
  this.options.allowUncaught = allowUncaught !== false;
19118
19067
  return this;
19119
19068
  };
@@ -19144,7 +19093,7 @@
19144
19093
  * @return {Mocha} this
19145
19094
  * @chainable
19146
19095
  */
19147
- Mocha.prototype.dryRun = function(dryRun) {
19096
+ Mocha.prototype.dryRun = function (dryRun) {
19148
19097
  this.options.dryRun = dryRun !== false;
19149
19098
  return this;
19150
19099
  };
@@ -19158,7 +19107,7 @@
19158
19107
  * @return {Mocha} this
19159
19108
  * @chainable
19160
19109
  */
19161
- Mocha.prototype.failZero = function(failZero) {
19110
+ Mocha.prototype.failZero = function (failZero) {
19162
19111
  this.options.failZero = failZero !== false;
19163
19112
  return this;
19164
19113
  };
@@ -19172,7 +19121,7 @@
19172
19121
  * @returns {Mocha} this
19173
19122
  * @chainable
19174
19123
  */
19175
- Mocha.prototype.forbidOnly = function(forbidOnly) {
19124
+ Mocha.prototype.forbidOnly = function (forbidOnly) {
19176
19125
  this.options.forbidOnly = forbidOnly !== false;
19177
19126
  return this;
19178
19127
  };
@@ -19186,7 +19135,7 @@
19186
19135
  * @returns {Mocha} this
19187
19136
  * @chainable
19188
19137
  */
19189
- Mocha.prototype.forbidPending = function(forbidPending) {
19138
+ Mocha.prototype.forbidPending = function (forbidPending) {
19190
19139
  this.options.forbidPending = forbidPending !== false;
19191
19140
  return this;
19192
19141
  };
@@ -19195,7 +19144,7 @@
19195
19144
  * Throws an error if mocha is in the wrong state to be able to transition to a "running" state.
19196
19145
  * @private
19197
19146
  */
19198
- Mocha.prototype._guardRunningStateTransition = function() {
19147
+ Mocha.prototype._guardRunningStateTransition = function () {
19199
19148
  if (this._state === mochaStates.RUNNING) {
19200
19149
  throw createMochaInstanceAlreadyRunningError(
19201
19150
  'Mocha instance is currently running tests, cannot start a next test run until this one is done',
@@ -19222,7 +19171,7 @@
19222
19171
  * @readonly
19223
19172
  */
19224
19173
  Object.defineProperty(Mocha.prototype, 'version', {
19225
- value: require$$10.version,
19174
+ value: require$$9.version,
19226
19175
  configurable: false,
19227
19176
  enumerable: true,
19228
19177
  writable: false
@@ -19254,7 +19203,7 @@
19254
19203
  * // exit with non-zero status if there were test failures
19255
19204
  * mocha.run(failures => process.exitCode = failures ? 1 : 0);
19256
19205
  */
19257
- Mocha.prototype.run = function(fn) {
19206
+ Mocha.prototype.run = function (fn) {
19258
19207
  this._guardRunningStateTransition();
19259
19208
  this._state = mochaStates.RUNNING;
19260
19209
  if (this._previousRunner) {
@@ -19400,7 +19349,7 @@
19400
19349
 
19401
19350
  // swap Runner class
19402
19351
  this._runnerClass = parallel
19403
- ? require$$11
19352
+ ? require$$10
19404
19353
  : exports.Runner;
19405
19354
 
19406
19355
  // lazyLoadFiles may have been set `true` otherwise (for ESM loading),
@@ -19557,9 +19506,10 @@
19557
19506
  * @public
19558
19507
  * @returns {boolean}
19559
19508
  */
19560
- Mocha.prototype.hasGlobalTeardownFixtures = function hasGlobalTeardownFixtures() {
19561
- return Boolean(this.options.globalTeardown.length);
19562
- };
19509
+ Mocha.prototype.hasGlobalTeardownFixtures =
19510
+ function hasGlobalTeardownFixtures() {
19511
+ return Boolean(this.options.globalTeardown.length);
19512
+ };
19563
19513
 
19564
19514
  /**
19565
19515
  * An alternative way to define root hooks that works with parallel runs.
@@ -19651,12 +19601,12 @@
19651
19601
  * Revert to original onerror handler if previously defined.
19652
19602
  */
19653
19603
 
19654
- process$1.removeListener = function(e, fn) {
19604
+ process$1.removeListener = function (e, fn) {
19655
19605
  if (e === 'uncaughtException') {
19656
19606
  if (originalOnerrorHandler) {
19657
19607
  commonjsGlobal.onerror = originalOnerrorHandler;
19658
19608
  } else {
19659
- commonjsGlobal.onerror = function() {};
19609
+ commonjsGlobal.onerror = function () {};
19660
19610
  }
19661
19611
  var i = uncaughtExceptionHandlers.indexOf(fn);
19662
19612
  if (i !== -1) {
@@ -19669,7 +19619,7 @@
19669
19619
  * Implements listenerCount for 'uncaughtException'.
19670
19620
  */
19671
19621
 
19672
- process$1.listenerCount = function(name) {
19622
+ process$1.listenerCount = function (name) {
19673
19623
  if (name === 'uncaughtException') {
19674
19624
  return uncaughtExceptionHandlers.length;
19675
19625
  }
@@ -19680,9 +19630,9 @@
19680
19630
  * Implements uncaughtException listener.
19681
19631
  */
19682
19632
 
19683
- process$1.on = function(e, fn) {
19633
+ process$1.on = function (e, fn) {
19684
19634
  if (e === 'uncaughtException') {
19685
- commonjsGlobal.onerror = function(err, url, line) {
19635
+ commonjsGlobal.onerror = function (err, url, line) {
19686
19636
  fn(new Error(err + ' (' + url + ':' + line + ')'));
19687
19637
  return !mocha.options.allowUncaught;
19688
19638
  };
@@ -19690,7 +19640,7 @@
19690
19640
  }
19691
19641
  };
19692
19642
 
19693
- process$1.listeners = function(e) {
19643
+ process$1.listeners = function (e) {
19694
19644
  if (e === 'uncaughtException') {
19695
19645
  return uncaughtExceptionHandlers;
19696
19646
  }
@@ -19721,7 +19671,7 @@
19721
19671
  * High-performance override of Runner.immediately.
19722
19672
  */
19723
19673
 
19724
- mocha$1.Runner.immediately = function(callback) {
19674
+ mocha$1.Runner.immediately = function (callback) {
19725
19675
  immediateQueue.push(callback);
19726
19676
  if (!immediateTimeout) {
19727
19677
  immediateTimeout = setTimeout$1(timeslice, 0);
@@ -19733,8 +19683,8 @@
19733
19683
  * This is useful when running tests in a browser because window.onerror will
19734
19684
  * only receive the 'message' attribute of the Error.
19735
19685
  */
19736
- mocha.throwError = function(err) {
19737
- uncaughtExceptionHandlers.forEach(function(fn) {
19686
+ mocha.throwError = function (err) {
19687
+ uncaughtExceptionHandlers.forEach(function (fn) {
19738
19688
  fn(err);
19739
19689
  });
19740
19690
  throw err;
@@ -19745,7 +19695,7 @@
19745
19695
  * Normally this would happen in Mocha.prototype.loadFiles.
19746
19696
  */
19747
19697
 
19748
- mocha.ui = function(ui) {
19698
+ mocha.ui = function (ui) {
19749
19699
  mocha$1.prototype.ui.call(this, ui);
19750
19700
  this.suite.emit('pre-require', commonjsGlobal, null, this);
19751
19701
  return this;
@@ -19755,7 +19705,7 @@
19755
19705
  * Setup mocha with the given setting options.
19756
19706
  */
19757
19707
 
19758
- mocha.setup = function(opts) {
19708
+ mocha.setup = function (opts) {
19759
19709
  if (typeof opts === 'string') {
19760
19710
  opts = {ui: opts};
19761
19711
  }
@@ -19764,10 +19714,10 @@
19764
19714
  }
19765
19715
  var self = this;
19766
19716
  Object.keys(opts)
19767
- .filter(function(opt) {
19717
+ .filter(function (opt) {
19768
19718
  return opt !== 'delay';
19769
19719
  })
19770
- .forEach(function(opt) {
19720
+ .forEach(function (opt) {
19771
19721
  if (Object.prototype.hasOwnProperty.call(opts, opt)) {
19772
19722
  self[opt](opts[opt]);
19773
19723
  }
@@ -19779,7 +19729,7 @@
19779
19729
  * Run mocha, returning the Runner.
19780
19730
  */
19781
19731
 
19782
- mocha.run = function(fn) {
19732
+ mocha.run = function (fn) {
19783
19733
  var options = mocha.options;
19784
19734
  mocha.globals('location');
19785
19735
 
@@ -19794,7 +19744,7 @@
19794
19744
  mocha.invert();
19795
19745
  }
19796
19746
 
19797
- return mocha$1.prototype.run.call(mocha, function(err) {
19747
+ return mocha$1.prototype.run.call(mocha, function (err) {
19798
19748
  // The DOM Document is not available in Web Workers.
19799
19749
  var document = commonjsGlobal.document;
19800
19750
  if (
@@ -19820,15 +19770,22 @@
19820
19770
  /**
19821
19771
  * Expose mocha.
19822
19772
  */
19823
-
19824
19773
  commonjsGlobal.Mocha = mocha$1;
19825
19774
  commonjsGlobal.mocha = mocha;
19826
19775
 
19827
- // this allows test/acceptance/required-tokens.js to pass; thus,
19828
- // you can now do `const describe = require('mocha').describe` in a
19829
- // browser context (assuming browserification). should fix #880
19830
- var browserEntry = Object.assign(mocha, commonjsGlobal);
19776
+ // for bundlers: enable `import {describe, it} from 'mocha'`
19777
+ // `bdd` interface only
19778
+ // prettier-ignore
19779
+ [
19780
+ 'describe', 'context', 'it', 'specify',
19781
+ 'xdescribe', 'xcontext', 'xit', 'xspecify',
19782
+ 'before', 'beforeEach', 'afterEach', 'after'
19783
+ ].forEach(function(key) {
19784
+ mocha[key] = commonjsGlobal[key];
19785
+ });
19786
+
19787
+ var browserEntry = mocha;
19831
19788
 
19832
19789
  return browserEntry;
19833
19790
 
19834
- })));
19791
+ }));