mocha 9.0.3 → 9.1.0

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.
package/mocha-es2018.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@9.0.3 in javascript ES2018
1
+ // mocha@9.1.0 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) :
@@ -146,38 +146,38 @@
146
146
  Item$1.prototype.run = function () {
147
147
  this.fun.apply(null, this.array);
148
148
  };
149
- var title = 'browser';
150
- var platform = 'browser';
151
- var browser$3 = true;
152
- var env = {};
153
- var argv = [];
154
- var version$1 = ''; // empty string to avoid regexp issues
155
- var versions = {};
156
- var release = {};
157
- var config = {};
158
-
159
- function noop() {}
160
-
161
- var on = noop;
162
- var addListener = noop;
163
- var once = noop;
164
- var off = noop;
165
- var removeListener = noop;
166
- var removeAllListeners = noop;
167
- var emit = noop;
168
-
169
- function binding(name) {
149
+ var title$1 = 'browser';
150
+ var platform$1 = 'browser';
151
+ var browser$4 = true;
152
+ var env$1 = {};
153
+ var argv$1 = [];
154
+ var version$2 = ''; // empty string to avoid regexp issues
155
+ var versions$1 = {};
156
+ var release$1 = {};
157
+ var config$1 = {};
158
+
159
+ function noop$1() {}
160
+
161
+ var on$1 = noop$1;
162
+ var addListener$1 = noop$1;
163
+ var once$1 = noop$1;
164
+ var off$1 = noop$1;
165
+ var removeListener$1 = noop$1;
166
+ var removeAllListeners$1 = noop$1;
167
+ var emit$1 = noop$1;
168
+
169
+ function binding$1(name) {
170
170
  throw new Error('process.binding is not supported');
171
171
  }
172
172
 
173
- function cwd () { return '/' }
174
- function chdir (dir) {
173
+ function cwd$1 () { return '/' }
174
+ function chdir$1 (dir) {
175
175
  throw new Error('process.chdir is not supported');
176
- }function umask() { return 0; }
176
+ }function umask$1() { return 0; }
177
177
 
178
178
  // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
179
179
  var performance$1 = global$1.performance || {};
180
- var performanceNow =
180
+ var performanceNow$1 =
181
181
  performance$1.now ||
182
182
  performance$1.mozNow ||
183
183
  performance$1.msNow ||
@@ -187,8 +187,8 @@
187
187
 
188
188
  // generate timestamp or delta
189
189
  // see http://nodejs.org/api/process.html#process_process_hrtime
190
- function hrtime(previousTimestamp){
191
- var clocktime = performanceNow.call(performance$1)*1e-3;
190
+ function hrtime$1(previousTimestamp){
191
+ var clocktime = performanceNow$1.call(performance$1)*1e-3;
192
192
  var seconds = Math.floor(clocktime);
193
193
  var nanoseconds = Math.floor((clocktime%1)*1e9);
194
194
  if (previousTimestamp) {
@@ -202,37 +202,37 @@
202
202
  return [seconds,nanoseconds]
203
203
  }
204
204
 
205
- var startTime = new Date();
206
- function uptime() {
205
+ var startTime$1 = new Date();
206
+ function uptime$1() {
207
207
  var currentTime = new Date();
208
- var dif = currentTime - startTime;
208
+ var dif = currentTime - startTime$1;
209
209
  return dif / 1000;
210
210
  }
211
211
 
212
- var process = {
212
+ var process$1 = {
213
213
  nextTick: nextTick$1,
214
- title: title,
215
- browser: browser$3,
216
- env: env,
217
- argv: argv,
218
- version: version$1,
219
- versions: versions,
220
- on: on,
221
- addListener: addListener,
222
- once: once,
223
- off: off,
224
- removeListener: removeListener,
225
- removeAllListeners: removeAllListeners,
226
- emit: emit,
227
- binding: binding,
228
- cwd: cwd,
229
- chdir: chdir,
230
- umask: umask,
231
- hrtime: hrtime,
232
- platform: platform,
233
- release: release,
234
- config: config,
235
- uptime: uptime
214
+ title: title$1,
215
+ browser: browser$4,
216
+ env: env$1,
217
+ argv: argv$1,
218
+ version: version$2,
219
+ versions: versions$1,
220
+ on: on$1,
221
+ addListener: addListener$1,
222
+ once: once$1,
223
+ off: off$1,
224
+ removeListener: removeListener$1,
225
+ removeAllListeners: removeAllListeners$1,
226
+ emit: emit$1,
227
+ binding: binding$1,
228
+ cwd: cwd$1,
229
+ chdir: chdir$1,
230
+ umask: umask$1,
231
+ hrtime: hrtime$1,
232
+ platform: platform$1,
233
+ release: release$1,
234
+ config: config$1,
235
+ uptime: uptime$1
236
236
  };
237
237
 
238
238
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2815,16 +2815,97 @@
2815
2815
  Item.prototype.run = function () {
2816
2816
  this.fun.apply(null, this.array);
2817
2817
  };
2818
+ var title = 'browser';
2819
+ var platform = 'browser';
2820
+ var browser$3 = true;
2821
+ var env = {};
2822
+ var argv = [];
2823
+ var version$1 = ''; // empty string to avoid regexp issues
2824
+ var versions = {};
2825
+ var release = {};
2826
+ var config = {};
2827
+
2828
+ function noop() {}
2829
+
2830
+ var on = noop;
2831
+ var addListener = noop;
2832
+ var once = noop;
2833
+ var off = noop;
2834
+ var removeListener = noop;
2835
+ var removeAllListeners = noop;
2836
+ var emit = noop;
2837
+
2838
+ function binding(name) {
2839
+ throw new Error('process.binding is not supported');
2840
+ }
2841
+
2842
+ function cwd () { return '/' }
2843
+ function chdir (dir) {
2844
+ throw new Error('process.chdir is not supported');
2845
+ }function umask() { return 0; }
2818
2846
 
2819
2847
  // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
2820
2848
  var performance = global$1.performance || {};
2821
- performance.now ||
2849
+ var performanceNow =
2850
+ performance.now ||
2822
2851
  performance.mozNow ||
2823
2852
  performance.msNow ||
2824
2853
  performance.oNow ||
2825
2854
  performance.webkitNow ||
2826
2855
  function(){ return (new Date()).getTime() };
2827
2856
 
2857
+ // generate timestamp or delta
2858
+ // see http://nodejs.org/api/process.html#process_process_hrtime
2859
+ function hrtime(previousTimestamp){
2860
+ var clocktime = performanceNow.call(performance)*1e-3;
2861
+ var seconds = Math.floor(clocktime);
2862
+ var nanoseconds = Math.floor((clocktime%1)*1e9);
2863
+ if (previousTimestamp) {
2864
+ seconds = seconds - previousTimestamp[0];
2865
+ nanoseconds = nanoseconds - previousTimestamp[1];
2866
+ if (nanoseconds<0) {
2867
+ seconds--;
2868
+ nanoseconds += 1e9;
2869
+ }
2870
+ }
2871
+ return [seconds,nanoseconds]
2872
+ }
2873
+
2874
+ var startTime = new Date();
2875
+ function uptime() {
2876
+ var currentTime = new Date();
2877
+ var dif = currentTime - startTime;
2878
+ return dif / 1000;
2879
+ }
2880
+
2881
+ var browser$1$1 = {
2882
+ nextTick: nextTick,
2883
+ title: title,
2884
+ browser: browser$3,
2885
+ env: env,
2886
+ argv: argv,
2887
+ version: version$1,
2888
+ versions: versions,
2889
+ on: on,
2890
+ addListener: addListener,
2891
+ once: once,
2892
+ off: off,
2893
+ removeListener: removeListener,
2894
+ removeAllListeners: removeAllListeners,
2895
+ emit: emit,
2896
+ binding: binding,
2897
+ cwd: cwd,
2898
+ chdir: chdir,
2899
+ umask: umask,
2900
+ hrtime: hrtime,
2901
+ platform: platform,
2902
+ release: release,
2903
+ config: config,
2904
+ uptime: uptime
2905
+ };
2906
+
2907
+ var process = browser$1$1;
2908
+
2828
2909
  var inherits$2;
2829
2910
  if (typeof Object.create === 'function'){
2830
2911
  inherits$2 = function inherits(ctor, superCtor) {
@@ -2900,10 +2981,18 @@
2900
2981
  };
2901
2982
  }
2902
2983
 
2984
+ if (process.noDeprecation === true) {
2985
+ return fn;
2986
+ }
2987
+
2903
2988
  var warned = false;
2904
2989
  function deprecated() {
2905
2990
  if (!warned) {
2906
- {
2991
+ if (process.throwDeprecation) {
2992
+ throw new Error(msg);
2993
+ } else if (process.traceDeprecation) {
2994
+ console.trace(msg);
2995
+ } else {
2907
2996
  console.error(msg);
2908
2997
  }
2909
2998
  warned = true;
@@ -2918,7 +3007,7 @@
2918
3007
  var debugEnviron;
2919
3008
  function debuglog(set) {
2920
3009
  if (isUndefined(debugEnviron))
2921
- debugEnviron = '';
3010
+ debugEnviron = process.env.NODE_DEBUG || '';
2922
3011
  set = set.toUpperCase();
2923
3012
  if (!debugs[set]) {
2924
3013
  if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
@@ -10290,8 +10379,8 @@
10290
10379
  * @returns {Boolean} whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha
10291
10380
  */
10292
10381
  exports.supportsEsModules = function(partialSupport) {
10293
- if (!exports.isBrowser() && process.versions && process.versions.node) {
10294
- var versionFields = process.versions.node.split('.');
10382
+ if (!exports.isBrowser() && process$1.versions && process$1.versions.node) {
10383
+ var versionFields = process$1.versions.node.split('.');
10295
10384
  var major = +versionFields[0];
10296
10385
  var minor = +versionFields[1];
10297
10386
 
@@ -10310,7 +10399,7 @@
10310
10399
  * @private
10311
10400
  */
10312
10401
  exports.cwd = function cwd() {
10313
- return process.cwd();
10402
+ return process$1.cwd();
10314
10403
  };
10315
10404
 
10316
10405
  /**
@@ -11058,8 +11147,8 @@
11058
11147
  }
11059
11148
 
11060
11149
  // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
11061
- if (!r && typeof process !== 'undefined' && 'env' in process) {
11062
- r = process.env.DEBUG;
11150
+ if (!r && typeof process$1 !== 'undefined' && 'env' in process$1) {
11151
+ r = process$1.env.DEBUG;
11063
11152
  }
11064
11153
 
11065
11154
  return r;
@@ -11118,8 +11207,8 @@
11118
11207
  * @ignore
11119
11208
  */
11120
11209
  const emitWarning = (msg, type) => {
11121
- if (process.emitWarning) {
11122
- process.emitWarning(msg, type);
11210
+ if (process$1.emitWarning) {
11211
+ process$1.emitWarning(msg, type);
11123
11212
  } else {
11124
11213
  /* istanbul ignore next */
11125
11214
  nextTick$1(function() {
@@ -13045,10 +13134,11 @@
13045
13134
  * @public
13046
13135
  * @class
13047
13136
  * @param {Suite} suite - Root suite
13048
- * @param {Object|boolean} [opts] - Options. If `boolean` (deprecated), whether or not to delay execution of root suite until ready.
13137
+ * @param {Object|boolean} [opts] - Options. If `boolean` (deprecated), whether to delay execution of root suite until ready.
13138
+ * @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
13049
13139
  * @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready.
13050
13140
  * @param {boolean} [opts.dryRun] - Whether to report tests without running them.
13051
- * @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
13141
+ * @param {boolean} [options.failZero] - Whether to fail test run if zero tests encountered.
13052
13142
  */
13053
13143
  constructor(suite, opts) {
13054
13144
  super();
@@ -13105,14 +13195,14 @@
13105
13195
  'trapped unhandled rejection from (probably) user code; re-emitting on process'
13106
13196
  );
13107
13197
  this._removeEventListener(
13108
- process,
13198
+ process$1,
13109
13199
  'unhandledRejection',
13110
13200
  this.unhandled
13111
13201
  );
13112
13202
  try {
13113
- process.emit('unhandledRejection', reason, promise);
13203
+ process$1.emit('unhandledRejection', reason, promise);
13114
13204
  } finally {
13115
- this._addEventListener(process, 'unhandledRejection', this.unhandled);
13205
+ this._addEventListener(process$1, 'unhandledRejection', this.unhandled);
13116
13206
  }
13117
13207
  }
13118
13208
  };
@@ -13954,6 +14044,8 @@
13954
14044
  fn = fn || function() {};
13955
14045
 
13956
14046
  const end = () => {
14047
+ if (!this.total && this._opts.failZero) this.failures = 1;
14048
+
13957
14049
  debug('run(): root suite completed; emitting %s', constants$1.EVENT_RUN_END);
13958
14050
  this.emit(constants$1.EVENT_RUN_END);
13959
14051
  };
@@ -13996,10 +14088,10 @@
13996
14088
  fn(this.failures);
13997
14089
  });
13998
14090
 
13999
- this._removeEventListener(process, 'uncaughtException', this.uncaught);
14000
- this._removeEventListener(process, 'unhandledRejection', this.unhandled);
14001
- this._addEventListener(process, 'uncaughtException', this.uncaught);
14002
- this._addEventListener(process, 'unhandledRejection', this.unhandled);
14091
+ this._removeEventListener(process$1, 'uncaughtException', this.uncaught);
14092
+ this._removeEventListener(process$1, 'unhandledRejection', this.unhandled);
14093
+ this._addEventListener(process$1, 'uncaughtException', this.uncaught);
14094
+ this._addEventListener(process$1, 'unhandledRejection', this.unhandled);
14003
14095
 
14004
14096
  if (this._delay) {
14005
14097
  // for reporters, I guess.
@@ -14214,7 +14306,7 @@
14214
14306
  * Check if both stdio streams are associated with a tty.
14215
14307
  */
14216
14308
 
14217
- var isatty = isBrowser || (process.stdout.isTTY && process.stderr.isTTY);
14309
+ var isatty = isBrowser || (process$1.stdout.isTTY && process$1.stderr.isTTY);
14218
14310
 
14219
14311
  /**
14220
14312
  * Save log references to avoid tests interfering (see GH-3604).
@@ -14227,7 +14319,7 @@
14227
14319
 
14228
14320
  exports.useColors =
14229
14321
  !isBrowser &&
14230
- (require$$11.stdout || process.env.MOCHA_COLORS !== undefined);
14322
+ (require$$11.stdout || process$1.env.MOCHA_COLORS !== undefined);
14231
14323
 
14232
14324
  /**
14233
14325
  * Inline diffs instead of +/-
@@ -14269,7 +14361,7 @@
14269
14361
 
14270
14362
  exports.symbols = {
14271
14363
  ok: browser$1.success,
14272
- err: browser$1.err,
14364
+ err: browser$1.error,
14273
14365
  dot: '.',
14274
14366
  comma: ',',
14275
14367
  bang: '!'
@@ -14305,7 +14397,7 @@
14305
14397
  if (isBrowser) {
14306
14398
  exports.window.width = getBrowserWindowSize()[1];
14307
14399
  } else {
14308
- exports.window.width = process.stdout.getWindowSize(1)[0];
14400
+ exports.window.width = process$1.stdout.getWindowSize(1)[0];
14309
14401
  }
14310
14402
  }
14311
14403
 
@@ -14315,19 +14407,19 @@
14315
14407
 
14316
14408
  exports.cursor = {
14317
14409
  hide: function() {
14318
- isatty && process.stdout.write('\u001b[?25l');
14410
+ isatty && process$1.stdout.write('\u001b[?25l');
14319
14411
  },
14320
14412
 
14321
14413
  show: function() {
14322
- isatty && process.stdout.write('\u001b[?25h');
14414
+ isatty && process$1.stdout.write('\u001b[?25h');
14323
14415
  },
14324
14416
 
14325
14417
  deleteLine: function() {
14326
- isatty && process.stdout.write('\u001b[2K');
14418
+ isatty && process$1.stdout.write('\u001b[2K');
14327
14419
  },
14328
14420
 
14329
14421
  beginningOfLine: function() {
14330
- isatty && process.stdout.write('\u001b[0G');
14422
+ isatty && process$1.stdout.write('\u001b[0G');
14331
14423
  },
14332
14424
 
14333
14425
  CR: function() {
@@ -14335,7 +14427,7 @@
14335
14427
  exports.cursor.deleteLine();
14336
14428
  exports.cursor.beginningOfLine();
14337
14429
  } else {
14338
- process.stdout.write('\r');
14430
+ process$1.stdout.write('\r');
14339
14431
  }
14340
14432
  }
14341
14433
  };
@@ -14757,36 +14849,36 @@
14757
14849
  var n = -1;
14758
14850
 
14759
14851
  runner.on(EVENT_RUN_BEGIN, function() {
14760
- process.stdout.write('\n');
14852
+ process$1.stdout.write('\n');
14761
14853
  });
14762
14854
 
14763
14855
  runner.on(EVENT_TEST_PENDING, function() {
14764
14856
  if (++n % width === 0) {
14765
- process.stdout.write('\n ');
14857
+ process$1.stdout.write('\n ');
14766
14858
  }
14767
- process.stdout.write(base.color('pending', base.symbols.comma));
14859
+ process$1.stdout.write(base.color('pending', base.symbols.comma));
14768
14860
  });
14769
14861
 
14770
14862
  runner.on(EVENT_TEST_PASS, function(test) {
14771
14863
  if (++n % width === 0) {
14772
- process.stdout.write('\n ');
14864
+ process$1.stdout.write('\n ');
14773
14865
  }
14774
14866
  if (test.speed === 'slow') {
14775
- process.stdout.write(base.color('bright yellow', base.symbols.dot));
14867
+ process$1.stdout.write(base.color('bright yellow', base.symbols.dot));
14776
14868
  } else {
14777
- process.stdout.write(base.color(test.speed, base.symbols.dot));
14869
+ process$1.stdout.write(base.color(test.speed, base.symbols.dot));
14778
14870
  }
14779
14871
  });
14780
14872
 
14781
14873
  runner.on(EVENT_TEST_FAIL, function() {
14782
14874
  if (++n % width === 0) {
14783
- process.stdout.write('\n ');
14875
+ process$1.stdout.write('\n ');
14784
14876
  }
14785
- process.stdout.write(base.color('fail', base.symbols.bang));
14877
+ process$1.stdout.write(base.color('fail', base.symbols.bang));
14786
14878
  });
14787
14879
 
14788
14880
  runner.once(EVENT_RUN_END, function() {
14789
- process.stdout.write('\n');
14881
+ process$1.stdout.write('\n');
14790
14882
  self.epilogue();
14791
14883
  });
14792
14884
  }
@@ -14998,7 +15090,7 @@
14998
15090
  function println(format, varArgs) {
14999
15091
  var vargs = Array.from(arguments);
15000
15092
  vargs[0] += '\n';
15001
- process.stdout.write(sprintf.apply(null, vargs));
15093
+ process$1.stdout.write(sprintf.apply(null, vargs));
15002
15094
  }
15003
15095
 
15004
15096
  /**
@@ -15191,6 +15283,8 @@
15191
15283
  TAP.description = 'TAP-compatible output';
15192
15284
  });
15193
15285
 
15286
+ var fs = {};
15287
+
15194
15288
  var json = createCommonjsModule(function (module, exports) {
15195
15289
  /**
15196
15290
  * @module JSON
@@ -15200,12 +15294,16 @@
15200
15294
  */
15201
15295
 
15202
15296
 
15297
+
15298
+
15299
+ const createUnsupportedError = errors.createUnsupportedError;
15300
+
15203
15301
  var constants = runner.constants;
15204
15302
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
15303
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
15205
15304
  var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
15206
15305
  var EVENT_TEST_END = constants.EVENT_TEST_END;
15207
15306
  var EVENT_RUN_END = constants.EVENT_RUN_END;
15208
- var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
15209
15307
 
15210
15308
  /**
15211
15309
  * Expose `JSON`.
@@ -15223,7 +15321,7 @@
15223
15321
  * @param {Runner} runner - Instance triggers reporter actions.
15224
15322
  * @param {Object} [options] - runner options
15225
15323
  */
15226
- function JSONReporter(runner, options) {
15324
+ function JSONReporter(runner, options = {}) {
15227
15325
  base.call(this, runner, options);
15228
15326
 
15229
15327
  var self = this;
@@ -15231,6 +15329,14 @@
15231
15329
  var pending = [];
15232
15330
  var failures = [];
15233
15331
  var passes = [];
15332
+ var output;
15333
+
15334
+ if (options.reporterOption && options.reporterOption.output) {
15335
+ if (utils.isBrowser()) {
15336
+ throw createUnsupportedError('file output not supported in browser');
15337
+ }
15338
+ output = options.reporterOption.output;
15339
+ }
15234
15340
 
15235
15341
  runner.on(EVENT_TEST_END, function(test) {
15236
15342
  tests.push(test);
@@ -15259,7 +15365,20 @@
15259
15365
 
15260
15366
  runner.testResults = obj;
15261
15367
 
15262
- process.stdout.write(JSON.stringify(obj, null, 2));
15368
+ var json = JSON.stringify(obj, null, 2);
15369
+ if (output) {
15370
+ try {
15371
+ fs.mkdirSync(path.dirname(output), {recursive: true});
15372
+ fs.writeFileSync(output, json);
15373
+ } catch (err) {
15374
+ console.error(
15375
+ `${base.symbols.err} [mocha] writing output to "${output}" failed: ${err.message}\n`
15376
+ );
15377
+ process$1.stdout.write(json);
15378
+ }
15379
+ } else {
15380
+ process$1.stdout.write(json);
15381
+ }
15263
15382
  });
15264
15383
  }
15265
15384
 
@@ -15891,7 +16010,7 @@
15891
16010
  });
15892
16011
 
15893
16012
  runner.on(EVENT_TEST_BEGIN, function(test) {
15894
- process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
16013
+ process$1.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
15895
16014
  });
15896
16015
 
15897
16016
  runner.on(EVENT_TEST_PENDING, function(test) {
@@ -15962,9 +16081,9 @@
15962
16081
 
15963
16082
  runner.on(EVENT_RUN_BEGIN, function() {
15964
16083
  // clear screen
15965
- process.stdout.write('\u001b[2J');
16084
+ process$1.stdout.write('\u001b[2J');
15966
16085
  // set cursor position
15967
- process.stdout.write('\u001b[1;3H');
16086
+ process$1.stdout.write('\u001b[1;3H');
15968
16087
  });
15969
16088
 
15970
16089
  runner.once(EVENT_RUN_END, this.epilogue.bind(this));
@@ -16351,7 +16470,7 @@
16351
16470
  * @param {string} string A message to write to stdout.
16352
16471
  */
16353
16472
  function write(string) {
16354
- process.stdout.write(string);
16473
+ process$1.stdout.write(string);
16355
16474
  }
16356
16475
 
16357
16476
  NyanCat.description = '"nyan cat"';
@@ -16494,8 +16613,8 @@
16494
16613
  XUnit.prototype.write = function(line) {
16495
16614
  if (this.fileStream) {
16496
16615
  this.fileStream.write(line + '\n');
16497
- } else if (typeof process === 'object' && process.stdout) {
16498
- process.stdout.write(line + '\n');
16616
+ } else if (typeof process$1 === 'object' && process$1.stdout) {
16617
+ process$1.stdout.write(line + '\n');
16499
16618
  } else {
16500
16619
  base.consoleLog(line);
16501
16620
  }
@@ -16676,9 +16795,9 @@
16676
16795
  });
16677
16796
 
16678
16797
  runner.once(EVENT_RUN_END, function() {
16679
- process.stdout.write('# TOC\n');
16680
- process.stdout.write(generateTOC(runner.suite));
16681
- process.stdout.write(buf);
16798
+ process$1.stdout.write('# TOC\n');
16799
+ process$1.stdout.write(generateTOC(runner.suite));
16800
+ process$1.stdout.write(buf);
16682
16801
  });
16683
16802
  }
16684
16803
 
@@ -16745,7 +16864,7 @@
16745
16864
 
16746
16865
  // tests started
16747
16866
  runner.on(EVENT_RUN_BEGIN, function() {
16748
- process.stdout.write('\n');
16867
+ process$1.stdout.write('\n');
16749
16868
  cursor.hide();
16750
16869
  });
16751
16870
 
@@ -16764,13 +16883,13 @@
16764
16883
  lastN = n;
16765
16884
 
16766
16885
  cursor.CR();
16767
- process.stdout.write('\u001b[J');
16768
- process.stdout.write(color('progress', ' ' + options.open));
16769
- process.stdout.write(Array(n).join(options.complete));
16770
- process.stdout.write(Array(i).join(options.incomplete));
16771
- process.stdout.write(color('progress', options.close));
16886
+ process$1.stdout.write('\u001b[J');
16887
+ process$1.stdout.write(color('progress', ' ' + options.open));
16888
+ process$1.stdout.write(Array(n).join(options.complete));
16889
+ process$1.stdout.write(Array(i).join(options.incomplete));
16890
+ process$1.stdout.write(color('progress', options.close));
16772
16891
  if (options.verbose) {
16773
- process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
16892
+ process$1.stdout.write(color('progress', ' ' + complete + ' of ' + total));
16774
16893
  }
16775
16894
  });
16776
16895
 
@@ -16778,7 +16897,7 @@
16778
16897
  // and the failures if any
16779
16898
  runner.once(EVENT_RUN_END, function() {
16780
16899
  cursor.show();
16781
- process.stdout.write('\n');
16900
+ process$1.stdout.write('\n');
16782
16901
  self.epilogue();
16783
16902
  });
16784
16903
  }
@@ -16849,7 +16968,7 @@
16849
16968
 
16850
16969
  var self = this;
16851
16970
  var width = (base.window.width * 0.75) | 0;
16852
- var stream = process.stdout;
16971
+ var stream = process$1.stdout;
16853
16972
 
16854
16973
  var plane = color('plane', '✈');
16855
16974
  var crashed = -1;
@@ -16888,15 +17007,15 @@
16888
17007
 
16889
17008
  runner.once(EVENT_RUN_END, function() {
16890
17009
  cursor.show();
16891
- process.stdout.write('\n');
17010
+ process$1.stdout.write('\n');
16892
17011
  self.epilogue();
16893
17012
  });
16894
17013
 
16895
17014
  // if cursor is hidden when we ctrl-C, then it will remain hidden unless...
16896
- process.once('SIGINT', function() {
17015
+ process$1.once('SIGINT', function() {
16897
17016
  cursor.show();
16898
17017
  nextTick$1(function() {
16899
- process.kill(process.pid, 'SIGINT');
17018
+ process$1.kill(process$1.pid, 'SIGINT');
16900
17019
  });
16901
17020
  });
16902
17021
  }
@@ -16978,7 +17097,7 @@
16978
17097
  * @param {JSONStream~MochaEvent} event - Mocha event to be output.
16979
17098
  */
16980
17099
  function writeEvent(event) {
16981
- process.stdout.write(JSON.stringify(event) + '\n');
17100
+ process$1.stdout.write(JSON.stringify(event) + '\n');
16982
17101
  }
16983
17102
 
16984
17103
  /**
@@ -17025,7 +17144,7 @@
17025
17144
  });
17026
17145
 
17027
17146
  var name = "mocha";
17028
- var version = "9.0.3";
17147
+ var version = "9.1.0";
17029
17148
  var homepage = "https://mochajs.org/";
17030
17149
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
17031
17150
  var _package = {
@@ -18274,6 +18393,7 @@
18274
18393
  * @param {boolean} [options.delay] - Delay root suite execution?
18275
18394
  * @param {boolean} [options.diff] - Show diff on failure?
18276
18395
  * @param {boolean} [options.dryRun] - Report tests without running them?
18396
+ * @param {boolean} [options.failZero] - Fail test run if zero tests?
18277
18397
  * @param {string} [options.fgrep] - Test filter given string.
18278
18398
  * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
18279
18399
  * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
@@ -18333,6 +18453,7 @@
18333
18453
  'delay',
18334
18454
  'diff',
18335
18455
  'dryRun',
18456
+ 'failZero',
18336
18457
  'forbidOnly',
18337
18458
  'forbidPending',
18338
18459
  'fullTrace',
@@ -18691,7 +18812,7 @@
18691
18812
  Mocha.prototype.grep = function(re) {
18692
18813
  if (utils.isString(re)) {
18693
18814
  // extract args if it's regex-like, i.e: [string, pattern, flag]
18694
- var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
18815
+ var arg = re.match(/^\/(.*)\/([gimy]{0,4})$|.*/);
18695
18816
  this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
18696
18817
  } else {
18697
18818
  this.options.grep = re;
@@ -18888,20 +19009,6 @@
18888
19009
  return this;
18889
19010
  };
18890
19011
 
18891
- /**
18892
- * Enables or disables running tests in dry-run mode.
18893
- *
18894
- * @public
18895
- * @see [CLI option](../#-dry-run)
18896
- * @param {boolean} [dryRun=true] - Whether to activate dry-run mode.
18897
- * @return {Mocha} this
18898
- * @chainable
18899
- */
18900
- Mocha.prototype.dryRun = function(dryRun) {
18901
- this.options.dryRun = dryRun !== false;
18902
- return this;
18903
- };
18904
-
18905
19012
  /**
18906
19013
  * @summary
18907
19014
  * Sets timeout threshold value.
@@ -19028,6 +19135,34 @@
19028
19135
  return this;
19029
19136
  };
19030
19137
 
19138
+ /**
19139
+ * Enables or disables running tests in dry-run mode.
19140
+ *
19141
+ * @public
19142
+ * @see [CLI option](../#-dry-run)
19143
+ * @param {boolean} [dryRun=true] - Whether to activate dry-run mode.
19144
+ * @return {Mocha} this
19145
+ * @chainable
19146
+ */
19147
+ Mocha.prototype.dryRun = function(dryRun) {
19148
+ this.options.dryRun = dryRun !== false;
19149
+ return this;
19150
+ };
19151
+
19152
+ /**
19153
+ * Fails test run if no tests encountered with exit-code 1.
19154
+ *
19155
+ * @public
19156
+ * @see [CLI option](../#-fail-zero)
19157
+ * @param {boolean} [failZero=true] - Whether to fail test run.
19158
+ * @return {Mocha} this
19159
+ * @chainable
19160
+ */
19161
+ Mocha.prototype.failZero = function(failZero) {
19162
+ this.options.failZero = failZero !== false;
19163
+ return this;
19164
+ };
19165
+
19031
19166
  /**
19032
19167
  * Causes tests marked `only` to fail the suite.
19033
19168
  *
@@ -19133,9 +19268,10 @@
19133
19268
  var options = this.options;
19134
19269
  options.files = this.files;
19135
19270
  const runner = new this._runnerClass(suite, {
19271
+ cleanReferencesAfterRun: this._cleanReferencesAfterRun,
19136
19272
  delay: options.delay,
19137
19273
  dryRun: options.dryRun,
19138
- cleanReferencesAfterRun: this._cleanReferencesAfterRun
19274
+ failZero: options.failZero
19139
19275
  });
19140
19276
  statsCollector(runner);
19141
19277
  var reporter = new this._reporter(runner, options);
@@ -19482,7 +19618,7 @@
19482
19618
  * Shim process.stdout.
19483
19619
  */
19484
19620
 
19485
- process.stdout = browserStdout({label: false});
19621
+ process$1.stdout = browserStdout({label: false});
19486
19622
 
19487
19623
 
19488
19624
 
@@ -19515,7 +19651,7 @@
19515
19651
  * Revert to original onerror handler if previously defined.
19516
19652
  */
19517
19653
 
19518
- process.removeListener = function(e, fn) {
19654
+ process$1.removeListener = function(e, fn) {
19519
19655
  if (e === 'uncaughtException') {
19520
19656
  if (originalOnerrorHandler) {
19521
19657
  commonjsGlobal.onerror = originalOnerrorHandler;
@@ -19533,7 +19669,7 @@
19533
19669
  * Implements listenerCount for 'uncaughtException'.
19534
19670
  */
19535
19671
 
19536
- process.listenerCount = function(name) {
19672
+ process$1.listenerCount = function(name) {
19537
19673
  if (name === 'uncaughtException') {
19538
19674
  return uncaughtExceptionHandlers.length;
19539
19675
  }
@@ -19544,7 +19680,7 @@
19544
19680
  * Implements uncaughtException listener.
19545
19681
  */
19546
19682
 
19547
- process.on = function(e, fn) {
19683
+ process$1.on = function(e, fn) {
19548
19684
  if (e === 'uncaughtException') {
19549
19685
  commonjsGlobal.onerror = function(err, url, line) {
19550
19686
  fn(new Error(err + ' (' + url + ':' + line + ')'));
@@ -19554,7 +19690,7 @@
19554
19690
  }
19555
19691
  };
19556
19692
 
19557
- process.listeners = function(e) {
19693
+ process$1.listeners = function(e) {
19558
19694
  if (e === 'uncaughtException') {
19559
19695
  return uncaughtExceptionHandlers;
19560
19696
  }
@@ -19679,7 +19815,7 @@
19679
19815
  * https://github.com/mochajs/mocha/pull/916
19680
19816
  */
19681
19817
 
19682
- mocha$1.process = process;
19818
+ mocha$1.process = process$1;
19683
19819
 
19684
19820
  /**
19685
19821
  * Expose mocha.