mocha 9.1.1 → 9.2.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/LICENSE +1 -1
- package/README.md +1 -1
- package/browser-entry.js +27 -20
- package/lib/browser/growl.js +5 -5
- package/lib/browser/parse-query.js +1 -1
- package/lib/browser/progress.js +6 -6
- package/lib/cli/one-and-dones.js +1 -2
- package/lib/cli/run-helpers.js +1 -1
- package/lib/cli/run.js +1 -1
- package/lib/cli/watch-run.js +3 -6
- package/lib/context.js +5 -5
- package/lib/errors.js +1 -1
- package/lib/hook.js +2 -2
- package/lib/interfaces/bdd.js +23 -20
- package/lib/interfaces/common.js +7 -7
- package/lib/interfaces/exports.js +1 -1
- package/lib/interfaces/qunit.js +7 -7
- package/lib/interfaces/tdd.js +9 -9
- package/lib/mocha.js +57 -67
- package/lib/nodejs/buffered-worker-pool.js +17 -1
- package/lib/{esm-utils.js → nodejs/esm-utils.js} +18 -3
- package/lib/reporters/base.js +18 -21
- package/lib/reporters/doc.js +4 -4
- package/lib/reporters/dot.js +5 -5
- package/lib/reporters/html.js +12 -12
- package/lib/reporters/json-stream.js +4 -4
- package/lib/reporters/json.js +7 -7
- package/lib/reporters/landing.js +5 -5
- package/lib/reporters/list.js +5 -5
- package/lib/reporters/markdown.js +5 -5
- package/lib/reporters/min.js +1 -1
- package/lib/reporters/nyan.js +16 -16
- package/lib/reporters/progress.js +3 -3
- package/lib/reporters/spec.js +6 -6
- package/lib/reporters/tap.js +17 -17
- package/lib/reporters/xunit.js +9 -9
- package/lib/runnable.js +21 -21
- package/lib/runner.js +44 -47
- package/lib/stats-collector.js +7 -7
- package/lib/suite.js +44 -73
- package/lib/test.js +4 -4
- package/lib/utils.js +19 -46
- package/mocha-es2018.js +435 -492
- package/mocha.js +1545 -1050
- package/mocha.js.map +1 -1
- package/package.json +50 -52
- package/CHANGELOG.md +0 -1004
package/mocha-es2018.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// mocha@9.
|
|
1
|
+
// mocha@9.2.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) :
|
|
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);
|
|
@@ -9425,30 +9425,22 @@
|
|
|
9425
9425
|
|
|
9426
9426
|
var browser$2 = true;
|
|
9427
9427
|
|
|
9428
|
-
// This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped
|
|
9429
|
-
// optimize the gzip compression for this alphabet.
|
|
9430
9428
|
let urlAlphabet =
|
|
9431
|
-
'
|
|
9432
|
-
|
|
9429
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
9433
9430
|
let customAlphabet = (alphabet, size) => {
|
|
9434
9431
|
return () => {
|
|
9435
9432
|
let id = '';
|
|
9436
|
-
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
9437
9433
|
let i = size;
|
|
9438
9434
|
while (i--) {
|
|
9439
|
-
// `| 0` is more compact and faster than `Math.floor()`.
|
|
9440
9435
|
id += alphabet[(Math.random() * alphabet.length) | 0];
|
|
9441
9436
|
}
|
|
9442
9437
|
return id
|
|
9443
9438
|
}
|
|
9444
9439
|
};
|
|
9445
|
-
|
|
9446
9440
|
let nanoid = (size = 21) => {
|
|
9447
9441
|
let id = '';
|
|
9448
|
-
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
9449
9442
|
let i = size;
|
|
9450
9443
|
while (i--) {
|
|
9451
|
-
// `| 0` is more compact and faster than `Math.floor()`.
|
|
9452
9444
|
id += urlAlphabet[(Math.random() * 64) | 0];
|
|
9453
9445
|
}
|
|
9454
9446
|
return id
|
|
@@ -9835,7 +9827,7 @@
|
|
|
9835
9827
|
* @param {string} html
|
|
9836
9828
|
* @return {string}
|
|
9837
9829
|
*/
|
|
9838
|
-
exports.escape = function(html) {
|
|
9830
|
+
exports.escape = function (html) {
|
|
9839
9831
|
return he.encode(String(html), {useNamedReferences: false});
|
|
9840
9832
|
};
|
|
9841
9833
|
|
|
@@ -9846,7 +9838,7 @@
|
|
|
9846
9838
|
* @param {Object} obj
|
|
9847
9839
|
* @return {boolean}
|
|
9848
9840
|
*/
|
|
9849
|
-
exports.isString = function(obj) {
|
|
9841
|
+
exports.isString = function (obj) {
|
|
9850
9842
|
return typeof obj === 'string';
|
|
9851
9843
|
};
|
|
9852
9844
|
|
|
@@ -9857,7 +9849,7 @@
|
|
|
9857
9849
|
* @param {string} str
|
|
9858
9850
|
* @return {string}
|
|
9859
9851
|
*/
|
|
9860
|
-
exports.slug = function(str) {
|
|
9852
|
+
exports.slug = function (str) {
|
|
9861
9853
|
return str
|
|
9862
9854
|
.toLowerCase()
|
|
9863
9855
|
.replace(/\s+/g, '-')
|
|
@@ -9871,7 +9863,7 @@
|
|
|
9871
9863
|
* @param {string} str
|
|
9872
9864
|
* @return {string}
|
|
9873
9865
|
*/
|
|
9874
|
-
exports.clean = function(str) {
|
|
9866
|
+
exports.clean = function (str) {
|
|
9875
9867
|
str = str
|
|
9876
9868
|
.replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
|
|
9877
9869
|
.replace(/^\uFEFF/, '')
|
|
@@ -10013,7 +10005,7 @@
|
|
|
10013
10005
|
* @param {*} value
|
|
10014
10006
|
* @return {string}
|
|
10015
10007
|
*/
|
|
10016
|
-
exports.stringify = function(value) {
|
|
10008
|
+
exports.stringify = function (value) {
|
|
10017
10009
|
var typeHint = canonicalType(value);
|
|
10018
10010
|
|
|
10019
10011
|
if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
|
@@ -10029,7 +10021,7 @@
|
|
|
10029
10021
|
// IE7/IE8 has a bizarre String constructor; needs to be coerced
|
|
10030
10022
|
// into an array and back to obj.
|
|
10031
10023
|
if (typeHint === 'string' && typeof value === 'object') {
|
|
10032
|
-
value = value.split('').reduce(function(acc, char, idx) {
|
|
10024
|
+
value = value.split('').reduce(function (acc, char, idx) {
|
|
10033
10025
|
acc[idx] = char;
|
|
10034
10026
|
return acc;
|
|
10035
10027
|
}, {});
|
|
@@ -10184,14 +10176,14 @@
|
|
|
10184
10176
|
canonicalizedObj = value;
|
|
10185
10177
|
break;
|
|
10186
10178
|
case 'array':
|
|
10187
|
-
withStack(value, function() {
|
|
10188
|
-
canonicalizedObj = value.map(function(item) {
|
|
10179
|
+
withStack(value, function () {
|
|
10180
|
+
canonicalizedObj = value.map(function (item) {
|
|
10189
10181
|
return exports.canonicalize(item, stack);
|
|
10190
10182
|
});
|
|
10191
10183
|
});
|
|
10192
10184
|
break;
|
|
10193
10185
|
case 'function':
|
|
10194
|
-
/* eslint-disable-next-line no-unused-vars */
|
|
10186
|
+
/* eslint-disable-next-line no-unused-vars, no-unreachable-loop */
|
|
10195
10187
|
for (prop in value) {
|
|
10196
10188
|
canonicalizedObj = {};
|
|
10197
10189
|
break;
|
|
@@ -10204,10 +10196,10 @@
|
|
|
10204
10196
|
/* falls through */
|
|
10205
10197
|
case 'object':
|
|
10206
10198
|
canonicalizedObj = canonicalizedObj || {};
|
|
10207
|
-
withStack(value, function() {
|
|
10199
|
+
withStack(value, function () {
|
|
10208
10200
|
Object.keys(value)
|
|
10209
10201
|
.sort()
|
|
10210
|
-
.forEach(function(key) {
|
|
10202
|
+
.forEach(function (key) {
|
|
10211
10203
|
canonicalizedObj[key] = exports.canonicalize(value[key], stack);
|
|
10212
10204
|
});
|
|
10213
10205
|
});
|
|
@@ -10235,7 +10227,7 @@
|
|
|
10235
10227
|
* (i.e: strip Mocha and internal node functions from stack trace).
|
|
10236
10228
|
* @returns {Function}
|
|
10237
10229
|
*/
|
|
10238
|
-
exports.stackTraceFilter = function() {
|
|
10230
|
+
exports.stackTraceFilter = function () {
|
|
10239
10231
|
// TODO: Replace with `process.browser`
|
|
10240
10232
|
var is = typeof document === 'undefined' ? {node: true} : {browser: true};
|
|
10241
10233
|
var slash = path.sep;
|
|
@@ -10243,9 +10235,8 @@
|
|
|
10243
10235
|
if (is.node) {
|
|
10244
10236
|
cwd = exports.cwd() + slash;
|
|
10245
10237
|
} else {
|
|
10246
|
-
cwd = (
|
|
10247
|
-
? window.location
|
|
10248
|
-
: location
|
|
10238
|
+
cwd = (
|
|
10239
|
+
typeof location === 'undefined' ? window.location : location
|
|
10249
10240
|
).href.replace(/\/[^/]*$/, '/');
|
|
10250
10241
|
slash = '/';
|
|
10251
10242
|
}
|
|
@@ -10269,10 +10260,10 @@
|
|
|
10269
10260
|
);
|
|
10270
10261
|
}
|
|
10271
10262
|
|
|
10272
|
-
return function(stack) {
|
|
10263
|
+
return function (stack) {
|
|
10273
10264
|
stack = stack.split('\n');
|
|
10274
10265
|
|
|
10275
|
-
stack = stack.reduce(function(list, line) {
|
|
10266
|
+
stack = stack.reduce(function (list, line) {
|
|
10276
10267
|
if (isMochaInternal(line)) {
|
|
10277
10268
|
return list;
|
|
10278
10269
|
}
|
|
@@ -10323,7 +10314,7 @@
|
|
|
10323
10314
|
* It's a noop.
|
|
10324
10315
|
* @public
|
|
10325
10316
|
*/
|
|
10326
|
-
exports.noop = function() {};
|
|
10317
|
+
exports.noop = function () {};
|
|
10327
10318
|
|
|
10328
10319
|
/**
|
|
10329
10320
|
* Creates a map-like object.
|
|
@@ -10340,7 +10331,7 @@
|
|
|
10340
10331
|
* @param {...*} [obj] - Arguments to `Object.assign()`.
|
|
10341
10332
|
* @returns {Object} An object with no prototype, having `...obj` properties
|
|
10342
10333
|
*/
|
|
10343
|
-
exports.createMap = function(obj) {
|
|
10334
|
+
exports.createMap = function (obj) {
|
|
10344
10335
|
return Object.assign.apply(
|
|
10345
10336
|
null,
|
|
10346
10337
|
[Object.create(null)].concat(Array.prototype.slice.call(arguments))
|
|
@@ -10359,39 +10350,13 @@
|
|
|
10359
10350
|
* @returns {Object} A frozen object with no prototype, having `...obj` properties
|
|
10360
10351
|
* @throws {TypeError} if argument is not a non-empty object.
|
|
10361
10352
|
*/
|
|
10362
|
-
exports.defineConstants = function(obj) {
|
|
10353
|
+
exports.defineConstants = function (obj) {
|
|
10363
10354
|
if (canonicalType(obj) !== 'object' || !Object.keys(obj).length) {
|
|
10364
10355
|
throw new TypeError('Invalid argument; expected a non-empty object');
|
|
10365
10356
|
}
|
|
10366
10357
|
return Object.freeze(exports.createMap(obj));
|
|
10367
10358
|
};
|
|
10368
10359
|
|
|
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
10360
|
/**
|
|
10396
10361
|
* Returns current working directory
|
|
10397
10362
|
*
|
|
@@ -10695,7 +10660,7 @@
|
|
|
10695
10660
|
|
|
10696
10661
|
/**
|
|
10697
10662
|
* Selects a color for a debug namespace
|
|
10698
|
-
* @param {String} namespace The namespace string for the
|
|
10663
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
10699
10664
|
* @return {Number|String} An ANSI color code for the given namespace
|
|
10700
10665
|
* @api private
|
|
10701
10666
|
*/
|
|
@@ -10721,6 +10686,8 @@
|
|
|
10721
10686
|
function createDebug(namespace) {
|
|
10722
10687
|
let prevTime;
|
|
10723
10688
|
let enableOverride = null;
|
|
10689
|
+
let namespacesCache;
|
|
10690
|
+
let enabledCache;
|
|
10724
10691
|
|
|
10725
10692
|
function debug(...args) {
|
|
10726
10693
|
// Disabled?
|
|
@@ -10781,7 +10748,17 @@
|
|
|
10781
10748
|
Object.defineProperty(debug, 'enabled', {
|
|
10782
10749
|
enumerable: true,
|
|
10783
10750
|
configurable: false,
|
|
10784
|
-
get: () =>
|
|
10751
|
+
get: () => {
|
|
10752
|
+
if (enableOverride !== null) {
|
|
10753
|
+
return enableOverride;
|
|
10754
|
+
}
|
|
10755
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
10756
|
+
namespacesCache = createDebug.namespaces;
|
|
10757
|
+
enabledCache = createDebug.enabled(namespace);
|
|
10758
|
+
}
|
|
10759
|
+
|
|
10760
|
+
return enabledCache;
|
|
10761
|
+
},
|
|
10785
10762
|
set: v => {
|
|
10786
10763
|
enableOverride = v;
|
|
10787
10764
|
}
|
|
@@ -10810,6 +10787,7 @@
|
|
|
10810
10787
|
*/
|
|
10811
10788
|
function enable(namespaces) {
|
|
10812
10789
|
createDebug.save(namespaces);
|
|
10790
|
+
createDebug.namespaces = namespaces;
|
|
10813
10791
|
|
|
10814
10792
|
createDebug.names = [];
|
|
10815
10793
|
createDebug.skips = [];
|
|
@@ -11211,7 +11189,7 @@
|
|
|
11211
11189
|
process$1.emitWarning(msg, type);
|
|
11212
11190
|
} else {
|
|
11213
11191
|
/* istanbul ignore next */
|
|
11214
|
-
nextTick$1(function() {
|
|
11192
|
+
nextTick$1(function () {
|
|
11215
11193
|
console.warn(type + ': ' + msg);
|
|
11216
11194
|
});
|
|
11217
11195
|
}
|
|
@@ -11803,7 +11781,7 @@
|
|
|
11803
11781
|
/**
|
|
11804
11782
|
* Resets the state initially or for a next run.
|
|
11805
11783
|
*/
|
|
11806
|
-
Runnable.prototype.reset = function() {
|
|
11784
|
+
Runnable.prototype.reset = function () {
|
|
11807
11785
|
this.timedOut = false;
|
|
11808
11786
|
this._currentRetry = 0;
|
|
11809
11787
|
this.pending = false;
|
|
@@ -11832,7 +11810,7 @@
|
|
|
11832
11810
|
* @returns {Runnable} this
|
|
11833
11811
|
* @chainable
|
|
11834
11812
|
*/
|
|
11835
|
-
Runnable.prototype.timeout = function(ms) {
|
|
11813
|
+
Runnable.prototype.timeout = function (ms) {
|
|
11836
11814
|
if (!arguments.length) {
|
|
11837
11815
|
return this._timeout;
|
|
11838
11816
|
}
|
|
@@ -11866,7 +11844,7 @@
|
|
|
11866
11844
|
* @param {number|string} ms
|
|
11867
11845
|
* @return {Runnable|number} ms or Runnable instance.
|
|
11868
11846
|
*/
|
|
11869
|
-
Runnable.prototype.slow = function(ms) {
|
|
11847
|
+
Runnable.prototype.slow = function (ms) {
|
|
11870
11848
|
if (!arguments.length || typeof ms === 'undefined') {
|
|
11871
11849
|
return this._slow;
|
|
11872
11850
|
}
|
|
@@ -11884,7 +11862,7 @@
|
|
|
11884
11862
|
* @memberof Mocha.Runnable
|
|
11885
11863
|
* @public
|
|
11886
11864
|
*/
|
|
11887
|
-
Runnable.prototype.skip = function() {
|
|
11865
|
+
Runnable.prototype.skip = function () {
|
|
11888
11866
|
this.pending = true;
|
|
11889
11867
|
throw new pending('sync skip; aborting execution');
|
|
11890
11868
|
};
|
|
@@ -11894,7 +11872,7 @@
|
|
|
11894
11872
|
*
|
|
11895
11873
|
* @private
|
|
11896
11874
|
*/
|
|
11897
|
-
Runnable.prototype.isPending = function() {
|
|
11875
|
+
Runnable.prototype.isPending = function () {
|
|
11898
11876
|
return this.pending || (this.parent && this.parent.isPending());
|
|
11899
11877
|
};
|
|
11900
11878
|
|
|
@@ -11903,7 +11881,7 @@
|
|
|
11903
11881
|
* @return {boolean}
|
|
11904
11882
|
* @private
|
|
11905
11883
|
*/
|
|
11906
|
-
Runnable.prototype.isFailed = function() {
|
|
11884
|
+
Runnable.prototype.isFailed = function () {
|
|
11907
11885
|
return !this.isPending() && this.state === constants$3.STATE_FAILED;
|
|
11908
11886
|
};
|
|
11909
11887
|
|
|
@@ -11912,7 +11890,7 @@
|
|
|
11912
11890
|
* @return {boolean}
|
|
11913
11891
|
* @private
|
|
11914
11892
|
*/
|
|
11915
|
-
Runnable.prototype.isPassed = function() {
|
|
11893
|
+
Runnable.prototype.isPassed = function () {
|
|
11916
11894
|
return !this.isPending() && this.state === constants$3.STATE_PASSED;
|
|
11917
11895
|
};
|
|
11918
11896
|
|
|
@@ -11921,7 +11899,7 @@
|
|
|
11921
11899
|
*
|
|
11922
11900
|
* @private
|
|
11923
11901
|
*/
|
|
11924
|
-
Runnable.prototype.retries = function(n) {
|
|
11902
|
+
Runnable.prototype.retries = function (n) {
|
|
11925
11903
|
if (!arguments.length) {
|
|
11926
11904
|
return this._retries;
|
|
11927
11905
|
}
|
|
@@ -11933,7 +11911,7 @@
|
|
|
11933
11911
|
*
|
|
11934
11912
|
* @private
|
|
11935
11913
|
*/
|
|
11936
|
-
Runnable.prototype.currentRetry = function(n) {
|
|
11914
|
+
Runnable.prototype.currentRetry = function (n) {
|
|
11937
11915
|
if (!arguments.length) {
|
|
11938
11916
|
return this._currentRetry;
|
|
11939
11917
|
}
|
|
@@ -11948,7 +11926,7 @@
|
|
|
11948
11926
|
* @public
|
|
11949
11927
|
* @return {string}
|
|
11950
11928
|
*/
|
|
11951
|
-
Runnable.prototype.fullTitle = function() {
|
|
11929
|
+
Runnable.prototype.fullTitle = function () {
|
|
11952
11930
|
return this.titlePath().join(' ');
|
|
11953
11931
|
};
|
|
11954
11932
|
|
|
@@ -11959,7 +11937,7 @@
|
|
|
11959
11937
|
* @public
|
|
11960
11938
|
* @return {string}
|
|
11961
11939
|
*/
|
|
11962
|
-
Runnable.prototype.titlePath = function() {
|
|
11940
|
+
Runnable.prototype.titlePath = function () {
|
|
11963
11941
|
return this.parent.titlePath().concat([this.title]);
|
|
11964
11942
|
};
|
|
11965
11943
|
|
|
@@ -11968,7 +11946,7 @@
|
|
|
11968
11946
|
*
|
|
11969
11947
|
* @private
|
|
11970
11948
|
*/
|
|
11971
|
-
Runnable.prototype.clearTimeout = function() {
|
|
11949
|
+
Runnable.prototype.clearTimeout = function () {
|
|
11972
11950
|
clearTimeout$1(this.timer);
|
|
11973
11951
|
};
|
|
11974
11952
|
|
|
@@ -11977,7 +11955,7 @@
|
|
|
11977
11955
|
*
|
|
11978
11956
|
* @private
|
|
11979
11957
|
*/
|
|
11980
|
-
Runnable.prototype.resetTimeout = function() {
|
|
11958
|
+
Runnable.prototype.resetTimeout = function () {
|
|
11981
11959
|
var self = this;
|
|
11982
11960
|
var ms = this.timeout();
|
|
11983
11961
|
|
|
@@ -11985,7 +11963,7 @@
|
|
|
11985
11963
|
return;
|
|
11986
11964
|
}
|
|
11987
11965
|
this.clearTimeout();
|
|
11988
|
-
this.timer = setTimeout$3(function() {
|
|
11966
|
+
this.timer = setTimeout$3(function () {
|
|
11989
11967
|
if (self.timeout() === 0) {
|
|
11990
11968
|
return;
|
|
11991
11969
|
}
|
|
@@ -12000,7 +11978,7 @@
|
|
|
12000
11978
|
* @private
|
|
12001
11979
|
* @param {string[]} globals
|
|
12002
11980
|
*/
|
|
12003
|
-
Runnable.prototype.globals = function(globals) {
|
|
11981
|
+
Runnable.prototype.globals = function (globals) {
|
|
12004
11982
|
if (!arguments.length) {
|
|
12005
11983
|
return this._allowedGlobals;
|
|
12006
11984
|
}
|
|
@@ -12013,7 +11991,7 @@
|
|
|
12013
11991
|
* @param {Function} fn
|
|
12014
11992
|
* @private
|
|
12015
11993
|
*/
|
|
12016
|
-
Runnable.prototype.run = function(fn) {
|
|
11994
|
+
Runnable.prototype.run = function (fn) {
|
|
12017
11995
|
var self = this;
|
|
12018
11996
|
var start = new Date$4();
|
|
12019
11997
|
var ctx = this.ctx;
|
|
@@ -12113,13 +12091,13 @@
|
|
|
12113
12091
|
if (result && typeof result.then === 'function') {
|
|
12114
12092
|
self.resetTimeout();
|
|
12115
12093
|
result.then(
|
|
12116
|
-
function() {
|
|
12094
|
+
function () {
|
|
12117
12095
|
done();
|
|
12118
12096
|
// Return null so libraries like bluebird do not warn about
|
|
12119
12097
|
// subsequently constructed Promises.
|
|
12120
12098
|
return null;
|
|
12121
12099
|
},
|
|
12122
|
-
function(reason) {
|
|
12100
|
+
function (reason) {
|
|
12123
12101
|
done(reason || new Error('Promise rejected with no or falsy reason'));
|
|
12124
12102
|
}
|
|
12125
12103
|
);
|
|
@@ -12137,7 +12115,7 @@
|
|
|
12137
12115
|
}
|
|
12138
12116
|
|
|
12139
12117
|
function callFnAsync(fn) {
|
|
12140
|
-
var result = fn.call(ctx, function(err) {
|
|
12118
|
+
var result = fn.call(ctx, function (err) {
|
|
12141
12119
|
if (err instanceof Error || toString.call(err) === '[object Error]') {
|
|
12142
12120
|
return done(err);
|
|
12143
12121
|
}
|
|
@@ -12169,7 +12147,7 @@
|
|
|
12169
12147
|
* @returns {Error} a "timeout" error
|
|
12170
12148
|
* @private
|
|
12171
12149
|
*/
|
|
12172
|
-
Runnable.prototype._timeoutError = function(ms) {
|
|
12150
|
+
Runnable.prototype._timeoutError = function (ms) {
|
|
12173
12151
|
let msg = `Timeout of ${ms}ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.`;
|
|
12174
12152
|
if (this.file) {
|
|
12175
12153
|
msg += ' (' + this.file + ')';
|
|
@@ -12209,7 +12187,7 @@
|
|
|
12209
12187
|
* @returns {*|Error} `value`, otherwise an `Error`
|
|
12210
12188
|
* @private
|
|
12211
12189
|
*/
|
|
12212
|
-
Runnable.toValueOrError = function(value) {
|
|
12190
|
+
Runnable.toValueOrError = function (value) {
|
|
12213
12191
|
return (
|
|
12214
12192
|
value ||
|
|
12215
12193
|
createInvalidExceptionError$1(
|
|
@@ -12251,7 +12229,7 @@
|
|
|
12251
12229
|
/**
|
|
12252
12230
|
* Resets the state for a next run.
|
|
12253
12231
|
*/
|
|
12254
|
-
Hook.prototype.reset = function() {
|
|
12232
|
+
Hook.prototype.reset = function () {
|
|
12255
12233
|
runnable.prototype.reset.call(this);
|
|
12256
12234
|
delete this._error;
|
|
12257
12235
|
};
|
|
@@ -12264,7 +12242,7 @@
|
|
|
12264
12242
|
* @param {Error} err
|
|
12265
12243
|
* @return {Error}
|
|
12266
12244
|
*/
|
|
12267
|
-
Hook.prototype.error = function(err) {
|
|
12245
|
+
Hook.prototype.error = function (err) {
|
|
12268
12246
|
if (!arguments.length) {
|
|
12269
12247
|
err = this._error;
|
|
12270
12248
|
this._error = null;
|
|
@@ -12320,7 +12298,6 @@
|
|
|
12320
12298
|
assignNewMochaID,
|
|
12321
12299
|
clamp,
|
|
12322
12300
|
constants: utilsConstants,
|
|
12323
|
-
createMap,
|
|
12324
12301
|
defineConstants,
|
|
12325
12302
|
getMochaID,
|
|
12326
12303
|
inherits,
|
|
@@ -12346,7 +12323,7 @@
|
|
|
12346
12323
|
* @param {string} title - Title
|
|
12347
12324
|
* @return {Suite}
|
|
12348
12325
|
*/
|
|
12349
|
-
Suite.create = function(parent, title) {
|
|
12326
|
+
Suite.create = function (parent, title) {
|
|
12350
12327
|
var suite = new Suite(title, parent.ctx);
|
|
12351
12328
|
suite.parent = parent;
|
|
12352
12329
|
title = suite.fullTitle();
|
|
@@ -12402,16 +12379,6 @@
|
|
|
12402
12379
|
});
|
|
12403
12380
|
|
|
12404
12381
|
this.reset();
|
|
12405
|
-
|
|
12406
|
-
this.on('newListener', function(event) {
|
|
12407
|
-
if (deprecatedEvents[event]) {
|
|
12408
|
-
errors.deprecate(
|
|
12409
|
-
'Event "' +
|
|
12410
|
-
event +
|
|
12411
|
-
'" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
|
|
12412
|
-
);
|
|
12413
|
-
}
|
|
12414
|
-
});
|
|
12415
12382
|
}
|
|
12416
12383
|
|
|
12417
12384
|
/**
|
|
@@ -12422,7 +12389,7 @@
|
|
|
12422
12389
|
/**
|
|
12423
12390
|
* Resets the state initially or for a next run.
|
|
12424
12391
|
*/
|
|
12425
|
-
Suite.prototype.reset = function() {
|
|
12392
|
+
Suite.prototype.reset = function () {
|
|
12426
12393
|
this.delayed = false;
|
|
12427
12394
|
function doReset(thingToReset) {
|
|
12428
12395
|
thingToReset.reset();
|
|
@@ -12441,7 +12408,7 @@
|
|
|
12441
12408
|
* @private
|
|
12442
12409
|
* @return {Suite}
|
|
12443
12410
|
*/
|
|
12444
|
-
Suite.prototype.clone = function() {
|
|
12411
|
+
Suite.prototype.clone = function () {
|
|
12445
12412
|
var suite = new Suite(this.title);
|
|
12446
12413
|
debug('clone');
|
|
12447
12414
|
suite.ctx = this.ctx;
|
|
@@ -12461,7 +12428,7 @@
|
|
|
12461
12428
|
* @param {number|string} ms
|
|
12462
12429
|
* @return {Suite|number} for chaining
|
|
12463
12430
|
*/
|
|
12464
|
-
Suite.prototype.timeout = function(ms) {
|
|
12431
|
+
Suite.prototype.timeout = function (ms) {
|
|
12465
12432
|
if (!arguments.length) {
|
|
12466
12433
|
return this._timeout;
|
|
12467
12434
|
}
|
|
@@ -12486,7 +12453,7 @@
|
|
|
12486
12453
|
* @param {number|string} n
|
|
12487
12454
|
* @return {Suite|number} for chaining
|
|
12488
12455
|
*/
|
|
12489
|
-
Suite.prototype.retries = function(n) {
|
|
12456
|
+
Suite.prototype.retries = function (n) {
|
|
12490
12457
|
if (!arguments.length) {
|
|
12491
12458
|
return this._retries;
|
|
12492
12459
|
}
|
|
@@ -12502,7 +12469,7 @@
|
|
|
12502
12469
|
* @param {number|string} ms
|
|
12503
12470
|
* @return {Suite|number} for chaining
|
|
12504
12471
|
*/
|
|
12505
|
-
Suite.prototype.slow = function(ms) {
|
|
12472
|
+
Suite.prototype.slow = function (ms) {
|
|
12506
12473
|
if (!arguments.length) {
|
|
12507
12474
|
return this._slow;
|
|
12508
12475
|
}
|
|
@@ -12521,7 +12488,7 @@
|
|
|
12521
12488
|
* @param {boolean} bail
|
|
12522
12489
|
* @return {Suite|number} for chaining
|
|
12523
12490
|
*/
|
|
12524
|
-
Suite.prototype.bail = function(bail) {
|
|
12491
|
+
Suite.prototype.bail = function (bail) {
|
|
12525
12492
|
if (!arguments.length) {
|
|
12526
12493
|
return this._bail;
|
|
12527
12494
|
}
|
|
@@ -12535,7 +12502,7 @@
|
|
|
12535
12502
|
*
|
|
12536
12503
|
* @private
|
|
12537
12504
|
*/
|
|
12538
|
-
Suite.prototype.isPending = function() {
|
|
12505
|
+
Suite.prototype.isPending = function () {
|
|
12539
12506
|
return this.pending || (this.parent && this.parent.isPending());
|
|
12540
12507
|
};
|
|
12541
12508
|
|
|
@@ -12546,7 +12513,7 @@
|
|
|
12546
12513
|
* @param {Function} fn - Hook callback
|
|
12547
12514
|
* @returns {Hook} A new hook
|
|
12548
12515
|
*/
|
|
12549
|
-
Suite.prototype._createHook = function(title, fn) {
|
|
12516
|
+
Suite.prototype._createHook = function (title, fn) {
|
|
12550
12517
|
var hook$1 = new hook(title, fn);
|
|
12551
12518
|
hook$1.parent = this;
|
|
12552
12519
|
hook$1.timeout(this.timeout());
|
|
@@ -12565,7 +12532,7 @@
|
|
|
12565
12532
|
* @param {Function} fn
|
|
12566
12533
|
* @return {Suite} for chaining
|
|
12567
12534
|
*/
|
|
12568
|
-
Suite.prototype.beforeAll = function(title, fn) {
|
|
12535
|
+
Suite.prototype.beforeAll = function (title, fn) {
|
|
12569
12536
|
if (this.isPending()) {
|
|
12570
12537
|
return this;
|
|
12571
12538
|
}
|
|
@@ -12589,7 +12556,7 @@
|
|
|
12589
12556
|
* @param {Function} fn
|
|
12590
12557
|
* @return {Suite} for chaining
|
|
12591
12558
|
*/
|
|
12592
|
-
Suite.prototype.afterAll = function(title, fn) {
|
|
12559
|
+
Suite.prototype.afterAll = function (title, fn) {
|
|
12593
12560
|
if (this.isPending()) {
|
|
12594
12561
|
return this;
|
|
12595
12562
|
}
|
|
@@ -12613,7 +12580,7 @@
|
|
|
12613
12580
|
* @param {Function} fn
|
|
12614
12581
|
* @return {Suite} for chaining
|
|
12615
12582
|
*/
|
|
12616
|
-
Suite.prototype.beforeEach = function(title, fn) {
|
|
12583
|
+
Suite.prototype.beforeEach = function (title, fn) {
|
|
12617
12584
|
if (this.isPending()) {
|
|
12618
12585
|
return this;
|
|
12619
12586
|
}
|
|
@@ -12637,7 +12604,7 @@
|
|
|
12637
12604
|
* @param {Function} fn
|
|
12638
12605
|
* @return {Suite} for chaining
|
|
12639
12606
|
*/
|
|
12640
|
-
Suite.prototype.afterEach = function(title, fn) {
|
|
12607
|
+
Suite.prototype.afterEach = function (title, fn) {
|
|
12641
12608
|
if (this.isPending()) {
|
|
12642
12609
|
return this;
|
|
12643
12610
|
}
|
|
@@ -12660,7 +12627,7 @@
|
|
|
12660
12627
|
* @param {Suite} suite
|
|
12661
12628
|
* @return {Suite} for chaining
|
|
12662
12629
|
*/
|
|
12663
|
-
Suite.prototype.addSuite = function(suite) {
|
|
12630
|
+
Suite.prototype.addSuite = function (suite) {
|
|
12664
12631
|
suite.parent = this;
|
|
12665
12632
|
suite.root = false;
|
|
12666
12633
|
suite.timeout(this.timeout());
|
|
@@ -12679,7 +12646,7 @@
|
|
|
12679
12646
|
* @param {Test} test
|
|
12680
12647
|
* @return {Suite} for chaining
|
|
12681
12648
|
*/
|
|
12682
|
-
Suite.prototype.addTest = function(test) {
|
|
12649
|
+
Suite.prototype.addTest = function (test) {
|
|
12683
12650
|
test.parent = this;
|
|
12684
12651
|
test.timeout(this.timeout());
|
|
12685
12652
|
test.retries(this.retries());
|
|
@@ -12698,7 +12665,7 @@
|
|
|
12698
12665
|
* @public
|
|
12699
12666
|
* @return {string}
|
|
12700
12667
|
*/
|
|
12701
|
-
Suite.prototype.fullTitle = function() {
|
|
12668
|
+
Suite.prototype.fullTitle = function () {
|
|
12702
12669
|
return this.titlePath().join(' ');
|
|
12703
12670
|
};
|
|
12704
12671
|
|
|
@@ -12710,7 +12677,7 @@
|
|
|
12710
12677
|
* @public
|
|
12711
12678
|
* @return {string}
|
|
12712
12679
|
*/
|
|
12713
|
-
Suite.prototype.titlePath = function() {
|
|
12680
|
+
Suite.prototype.titlePath = function () {
|
|
12714
12681
|
var result = [];
|
|
12715
12682
|
if (this.parent) {
|
|
12716
12683
|
result = result.concat(this.parent.titlePath());
|
|
@@ -12728,9 +12695,9 @@
|
|
|
12728
12695
|
* @public
|
|
12729
12696
|
* @return {number}
|
|
12730
12697
|
*/
|
|
12731
|
-
Suite.prototype.total = function() {
|
|
12698
|
+
Suite.prototype.total = function () {
|
|
12732
12699
|
return (
|
|
12733
|
-
this.suites.reduce(function(sum, suite) {
|
|
12700
|
+
this.suites.reduce(function (sum, suite) {
|
|
12734
12701
|
return sum + suite.total();
|
|
12735
12702
|
}, 0) + this.tests.length
|
|
12736
12703
|
);
|
|
@@ -12744,9 +12711,9 @@
|
|
|
12744
12711
|
* @param {Function} fn
|
|
12745
12712
|
* @return {Suite}
|
|
12746
12713
|
*/
|
|
12747
|
-
Suite.prototype.eachTest = function(fn) {
|
|
12714
|
+
Suite.prototype.eachTest = function (fn) {
|
|
12748
12715
|
this.tests.forEach(fn);
|
|
12749
|
-
this.suites.forEach(function(suite) {
|
|
12716
|
+
this.suites.forEach(function (suite) {
|
|
12750
12717
|
suite.eachTest(fn);
|
|
12751
12718
|
});
|
|
12752
12719
|
return this;
|
|
@@ -12772,7 +12739,7 @@
|
|
|
12772
12739
|
return (
|
|
12773
12740
|
this._onlyTests.length > 0 ||
|
|
12774
12741
|
this._onlySuites.length > 0 ||
|
|
12775
|
-
this.suites.some(function(suite) {
|
|
12742
|
+
this.suites.some(function (suite) {
|
|
12776
12743
|
return suite.hasOnly();
|
|
12777
12744
|
})
|
|
12778
12745
|
);
|
|
@@ -12792,7 +12759,7 @@
|
|
|
12792
12759
|
} else {
|
|
12793
12760
|
// Otherwise, do not run any of the tests in this suite.
|
|
12794
12761
|
this.tests = [];
|
|
12795
|
-
this._onlySuites.forEach(function(onlySuite) {
|
|
12762
|
+
this._onlySuites.forEach(function (onlySuite) {
|
|
12796
12763
|
// If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
|
|
12797
12764
|
// Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
|
|
12798
12765
|
if (onlySuite.hasOnly()) {
|
|
@@ -12801,7 +12768,7 @@
|
|
|
12801
12768
|
});
|
|
12802
12769
|
// Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
|
|
12803
12770
|
var onlySuites = this._onlySuites;
|
|
12804
|
-
this.suites = this.suites.filter(function(childSuite) {
|
|
12771
|
+
this.suites = this.suites.filter(function (childSuite) {
|
|
12805
12772
|
return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
|
|
12806
12773
|
});
|
|
12807
12774
|
}
|
|
@@ -12815,7 +12782,7 @@
|
|
|
12815
12782
|
* @private
|
|
12816
12783
|
* @param {Suite} suite
|
|
12817
12784
|
*/
|
|
12818
|
-
Suite.prototype.appendOnlySuite = function(suite) {
|
|
12785
|
+
Suite.prototype.appendOnlySuite = function (suite) {
|
|
12819
12786
|
this._onlySuites.push(suite);
|
|
12820
12787
|
};
|
|
12821
12788
|
|
|
@@ -12824,7 +12791,7 @@
|
|
|
12824
12791
|
*
|
|
12825
12792
|
* @private
|
|
12826
12793
|
*/
|
|
12827
|
-
Suite.prototype.markOnly = function() {
|
|
12794
|
+
Suite.prototype.markOnly = function () {
|
|
12828
12795
|
this.parent && this.parent.appendOnlySuite(this);
|
|
12829
12796
|
};
|
|
12830
12797
|
|
|
@@ -12834,7 +12801,7 @@
|
|
|
12834
12801
|
* @private
|
|
12835
12802
|
* @param {Test} test
|
|
12836
12803
|
*/
|
|
12837
|
-
Suite.prototype.appendOnlyTest = function(test) {
|
|
12804
|
+
Suite.prototype.appendOnlyTest = function (test) {
|
|
12838
12805
|
this._onlyTests.push(test);
|
|
12839
12806
|
};
|
|
12840
12807
|
|
|
@@ -12849,8 +12816,8 @@
|
|
|
12849
12816
|
/**
|
|
12850
12817
|
* cleans all references from this suite and all child suites.
|
|
12851
12818
|
*/
|
|
12852
|
-
Suite.prototype.dispose = function() {
|
|
12853
|
-
this.suites.forEach(function(suite) {
|
|
12819
|
+
Suite.prototype.dispose = function () {
|
|
12820
|
+
this.suites.forEach(function (suite) {
|
|
12854
12821
|
suite.dispose();
|
|
12855
12822
|
});
|
|
12856
12823
|
this.cleanReferences();
|
|
@@ -12924,7 +12891,7 @@
|
|
|
12924
12891
|
*/
|
|
12925
12892
|
{
|
|
12926
12893
|
/**
|
|
12927
|
-
* Event emitted after a test file has been loaded Not emitted in browser.
|
|
12894
|
+
* Event emitted after a test file has been loaded. Not emitted in browser.
|
|
12928
12895
|
*/
|
|
12929
12896
|
EVENT_FILE_POST_REQUIRE: 'post-require',
|
|
12930
12897
|
/**
|
|
@@ -12936,72 +12903,54 @@
|
|
|
12936
12903
|
*/
|
|
12937
12904
|
EVENT_FILE_REQUIRE: 'require',
|
|
12938
12905
|
/**
|
|
12939
|
-
* Event emitted when `global.run()` is called (use with `delay` option)
|
|
12906
|
+
* Event emitted when `global.run()` is called (use with `delay` option).
|
|
12940
12907
|
*/
|
|
12941
12908
|
EVENT_ROOT_SUITE_RUN: 'run',
|
|
12942
12909
|
|
|
12943
12910
|
/**
|
|
12944
|
-
* Namespace for collection of a `Suite`'s "after all" hooks
|
|
12911
|
+
* Namespace for collection of a `Suite`'s "after all" hooks.
|
|
12945
12912
|
*/
|
|
12946
12913
|
HOOK_TYPE_AFTER_ALL: 'afterAll',
|
|
12947
12914
|
/**
|
|
12948
|
-
* Namespace for collection of a `Suite`'s "after each" hooks
|
|
12915
|
+
* Namespace for collection of a `Suite`'s "after each" hooks.
|
|
12949
12916
|
*/
|
|
12950
12917
|
HOOK_TYPE_AFTER_EACH: 'afterEach',
|
|
12951
12918
|
/**
|
|
12952
|
-
* Namespace for collection of a `Suite`'s "before all" hooks
|
|
12919
|
+
* Namespace for collection of a `Suite`'s "before all" hooks.
|
|
12953
12920
|
*/
|
|
12954
12921
|
HOOK_TYPE_BEFORE_ALL: 'beforeAll',
|
|
12955
12922
|
/**
|
|
12956
|
-
* Namespace for collection of a `Suite`'s "before
|
|
12923
|
+
* Namespace for collection of a `Suite`'s "before each" hooks.
|
|
12957
12924
|
*/
|
|
12958
12925
|
HOOK_TYPE_BEFORE_EACH: 'beforeEach',
|
|
12959
12926
|
|
|
12960
|
-
// the following events are all deprecated
|
|
12961
|
-
|
|
12962
12927
|
/**
|
|
12963
|
-
* Emitted after
|
|
12928
|
+
* Emitted after a child `Suite` has been added to a `Suite`.
|
|
12929
|
+
*/
|
|
12930
|
+
EVENT_SUITE_ADD_SUITE: 'suite',
|
|
12931
|
+
/**
|
|
12932
|
+
* Emitted after an "after all" `Hook` has been added to a `Suite`.
|
|
12964
12933
|
*/
|
|
12965
12934
|
EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
|
|
12966
12935
|
/**
|
|
12967
|
-
* Emitted after an "after each" `Hook` has been added to a `Suite
|
|
12936
|
+
* Emitted after an "after each" `Hook` has been added to a `Suite`.
|
|
12968
12937
|
*/
|
|
12969
12938
|
EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
|
|
12970
12939
|
/**
|
|
12971
|
-
* Emitted after an "before all" `Hook` has been added to a `Suite
|
|
12940
|
+
* Emitted after an "before all" `Hook` has been added to a `Suite`.
|
|
12972
12941
|
*/
|
|
12973
12942
|
EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
|
|
12974
12943
|
/**
|
|
12975
|
-
* Emitted after an "before each" `Hook` has been added to a `Suite
|
|
12944
|
+
* Emitted after an "before each" `Hook` has been added to a `Suite`.
|
|
12976
12945
|
*/
|
|
12977
12946
|
EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
|
|
12978
12947
|
/**
|
|
12979
|
-
* Emitted after a
|
|
12980
|
-
*/
|
|
12981
|
-
EVENT_SUITE_ADD_SUITE: 'suite',
|
|
12982
|
-
/**
|
|
12983
|
-
* Emitted after a `Test` has been added to a `Suite`. Deprecated
|
|
12948
|
+
* Emitted after a `Test` has been added to a `Suite`.
|
|
12984
12949
|
*/
|
|
12985
12950
|
EVENT_SUITE_ADD_TEST: 'test'
|
|
12986
12951
|
}
|
|
12987
12952
|
);
|
|
12988
12953
|
|
|
12989
|
-
/**
|
|
12990
|
-
* @summary There are no known use cases for these events.
|
|
12991
|
-
* @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
|
|
12992
|
-
* @todo Remove eventually
|
|
12993
|
-
* @type {Object<string,boolean>}
|
|
12994
|
-
* @ignore
|
|
12995
|
-
*/
|
|
12996
|
-
var deprecatedEvents = Object.keys(constants)
|
|
12997
|
-
.filter(function(constant) {
|
|
12998
|
-
return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
|
|
12999
|
-
})
|
|
13000
|
-
.reduce(function(acc, constant) {
|
|
13001
|
-
acc[constants[constant]] = true;
|
|
13002
|
-
return acc;
|
|
13003
|
-
}, createMap());
|
|
13004
|
-
|
|
13005
12954
|
Suite.constants = constants;
|
|
13006
12955
|
});
|
|
13007
12956
|
|
|
@@ -13144,7 +13093,7 @@
|
|
|
13144
13093
|
* @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
|
|
13145
13094
|
* @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready.
|
|
13146
13095
|
* @param {boolean} [opts.dryRun] - Whether to report tests without running them.
|
|
13147
|
-
* @param {boolean} [
|
|
13096
|
+
* @param {boolean} [opts.failZero] - Whether to fail test run if zero tests encountered.
|
|
13148
13097
|
*/
|
|
13149
13098
|
constructor(suite, opts) {
|
|
13150
13099
|
super();
|
|
@@ -13173,7 +13122,7 @@
|
|
|
13173
13122
|
* @type {Map<EventEmitter,Map<string,Set<EventListener>>>}
|
|
13174
13123
|
*/
|
|
13175
13124
|
this._eventListeners = new Map();
|
|
13176
|
-
this.on(constants$1.EVENT_TEST_END, function(test) {
|
|
13125
|
+
this.on(constants$1.EVENT_TEST_END, function (test) {
|
|
13177
13126
|
if (test.type === 'test' && test.retriedTest() && test.parent) {
|
|
13178
13127
|
var idx =
|
|
13179
13128
|
test.parent.tests && test.parent.tests.indexOf(test.retriedTest());
|
|
@@ -13181,7 +13130,7 @@
|
|
|
13181
13130
|
}
|
|
13182
13131
|
self.checkGlobals(test);
|
|
13183
13132
|
});
|
|
13184
|
-
this.on(constants$1.EVENT_HOOK_END, function(hook) {
|
|
13133
|
+
this.on(constants$1.EVENT_HOOK_END, function (hook) {
|
|
13185
13134
|
self.checkGlobals(hook);
|
|
13186
13135
|
});
|
|
13187
13136
|
this._defaultGrep = /.*/;
|
|
@@ -13230,7 +13179,7 @@
|
|
|
13230
13179
|
* @param {string} fn - Listener function
|
|
13231
13180
|
* @private
|
|
13232
13181
|
*/
|
|
13233
|
-
Runner.prototype._addEventListener = function(target, eventName, listener) {
|
|
13182
|
+
Runner.prototype._addEventListener = function (target, eventName, listener) {
|
|
13234
13183
|
debug(
|
|
13235
13184
|
'_addEventListener(): adding for event %s; %d current listeners',
|
|
13236
13185
|
eventName,
|
|
@@ -13240,10 +13189,7 @@
|
|
|
13240
13189
|
if (
|
|
13241
13190
|
this._eventListeners.has(target) &&
|
|
13242
13191
|
this._eventListeners.get(target).has(eventName) &&
|
|
13243
|
-
this._eventListeners
|
|
13244
|
-
.get(target)
|
|
13245
|
-
.get(eventName)
|
|
13246
|
-
.has(listener)
|
|
13192
|
+
this._eventListeners.get(target).get(eventName).has(listener)
|
|
13247
13193
|
) {
|
|
13248
13194
|
debug(
|
|
13249
13195
|
'warning: tried to attach duplicate event listener for %s',
|
|
@@ -13270,7 +13216,7 @@
|
|
|
13270
13216
|
* @param {function} listener - Listener function
|
|
13271
13217
|
* @private
|
|
13272
13218
|
*/
|
|
13273
|
-
Runner.prototype._removeEventListener = function(target, eventName, listener) {
|
|
13219
|
+
Runner.prototype._removeEventListener = function (target, eventName, listener) {
|
|
13274
13220
|
target.removeListener(eventName, listener);
|
|
13275
13221
|
|
|
13276
13222
|
if (this._eventListeners.has(target)) {
|
|
@@ -13294,7 +13240,7 @@
|
|
|
13294
13240
|
* Removes all event handlers set during a run on this instance.
|
|
13295
13241
|
* Remark: this does _not_ clean/dispose the tests or suites themselves.
|
|
13296
13242
|
*/
|
|
13297
|
-
Runner.prototype.dispose = function() {
|
|
13243
|
+
Runner.prototype.dispose = function () {
|
|
13298
13244
|
this.removeAllListeners();
|
|
13299
13245
|
this._eventListeners.forEach((targetListeners, target) => {
|
|
13300
13246
|
targetListeners.forEach((targetEventListeners, eventName) => {
|
|
@@ -13316,7 +13262,7 @@
|
|
|
13316
13262
|
* @param {boolean} invert
|
|
13317
13263
|
* @return {Runner} Runner instance.
|
|
13318
13264
|
*/
|
|
13319
|
-
Runner.prototype.grep = function(re, invert) {
|
|
13265
|
+
Runner.prototype.grep = function (re, invert) {
|
|
13320
13266
|
debug('grep(): setting to %s', re);
|
|
13321
13267
|
this._grep = re;
|
|
13322
13268
|
this._invert = invert;
|
|
@@ -13333,11 +13279,11 @@
|
|
|
13333
13279
|
* @param {Suite} suite
|
|
13334
13280
|
* @return {number}
|
|
13335
13281
|
*/
|
|
13336
|
-
Runner.prototype.grepTotal = function(suite) {
|
|
13282
|
+
Runner.prototype.grepTotal = function (suite) {
|
|
13337
13283
|
var self = this;
|
|
13338
13284
|
var total = 0;
|
|
13339
13285
|
|
|
13340
|
-
suite.eachTest(function(test) {
|
|
13286
|
+
suite.eachTest(function (test) {
|
|
13341
13287
|
var match = self._grep.test(test.fullTitle());
|
|
13342
13288
|
if (self._invert) {
|
|
13343
13289
|
match = !match;
|
|
@@ -13356,7 +13302,7 @@
|
|
|
13356
13302
|
* @return {Array}
|
|
13357
13303
|
* @private
|
|
13358
13304
|
*/
|
|
13359
|
-
Runner.prototype.globalProps = function() {
|
|
13305
|
+
Runner.prototype.globalProps = function () {
|
|
13360
13306
|
var props = Object.keys(commonjsGlobal);
|
|
13361
13307
|
|
|
13362
13308
|
// non-enumerables
|
|
@@ -13378,7 +13324,7 @@
|
|
|
13378
13324
|
* @param {Array} arr
|
|
13379
13325
|
* @return {Runner} Runner instance.
|
|
13380
13326
|
*/
|
|
13381
|
-
Runner.prototype.globals = function(arr) {
|
|
13327
|
+
Runner.prototype.globals = function (arr) {
|
|
13382
13328
|
if (!arguments.length) {
|
|
13383
13329
|
return this._globals;
|
|
13384
13330
|
}
|
|
@@ -13392,7 +13338,7 @@
|
|
|
13392
13338
|
*
|
|
13393
13339
|
* @private
|
|
13394
13340
|
*/
|
|
13395
|
-
Runner.prototype.checkGlobals = function(test) {
|
|
13341
|
+
Runner.prototype.checkGlobals = function (test) {
|
|
13396
13342
|
if (!this.checkLeaks) {
|
|
13397
13343
|
return;
|
|
13398
13344
|
}
|
|
@@ -13440,7 +13386,7 @@
|
|
|
13440
13386
|
* @param {Error} err
|
|
13441
13387
|
* @param {boolean} [force=false] - Whether to fail a pending test.
|
|
13442
13388
|
*/
|
|
13443
|
-
Runner.prototype.fail = function(test, err, force) {
|
|
13389
|
+
Runner.prototype.fail = function (test, err, force) {
|
|
13444
13390
|
force = force === true;
|
|
13445
13391
|
if (test.isPending() && !force) {
|
|
13446
13392
|
return;
|
|
@@ -13481,7 +13427,7 @@
|
|
|
13481
13427
|
* @param {Function} fn
|
|
13482
13428
|
*/
|
|
13483
13429
|
|
|
13484
|
-
Runner.prototype.hook = function(name, fn) {
|
|
13430
|
+
Runner.prototype.hook = function (name, fn) {
|
|
13485
13431
|
if (this._opts.dryRun) return fn();
|
|
13486
13432
|
|
|
13487
13433
|
var suite = this.suite;
|
|
@@ -13510,7 +13456,7 @@
|
|
|
13510
13456
|
self.emit(constants$1.EVENT_HOOK_BEGIN, hook);
|
|
13511
13457
|
|
|
13512
13458
|
if (!hook.listeners('error').length) {
|
|
13513
|
-
self._addEventListener(hook, 'error', function(err) {
|
|
13459
|
+
self._addEventListener(hook, 'error', function (err) {
|
|
13514
13460
|
self.fail(hook, err);
|
|
13515
13461
|
});
|
|
13516
13462
|
}
|
|
@@ -13535,10 +13481,10 @@
|
|
|
13535
13481
|
hook.pending = false; // activates hook for next test
|
|
13536
13482
|
return fn(new Error('abort hookDown'));
|
|
13537
13483
|
} else if (name === HOOK_TYPE_BEFORE_ALL) {
|
|
13538
|
-
suite.tests.forEach(function(test) {
|
|
13484
|
+
suite.tests.forEach(function (test) {
|
|
13539
13485
|
test.pending = true;
|
|
13540
13486
|
});
|
|
13541
|
-
suite.suites.forEach(function(suite) {
|
|
13487
|
+
suite.suites.forEach(function (suite) {
|
|
13542
13488
|
suite.pending = true;
|
|
13543
13489
|
});
|
|
13544
13490
|
hooks = [];
|
|
@@ -13575,7 +13521,7 @@
|
|
|
13575
13521
|
}
|
|
13576
13522
|
}
|
|
13577
13523
|
|
|
13578
|
-
Runner.immediately(function() {
|
|
13524
|
+
Runner.immediately(function () {
|
|
13579
13525
|
next(0);
|
|
13580
13526
|
});
|
|
13581
13527
|
};
|
|
@@ -13589,7 +13535,7 @@
|
|
|
13589
13535
|
* @param {Array} suites
|
|
13590
13536
|
* @param {Function} fn
|
|
13591
13537
|
*/
|
|
13592
|
-
Runner.prototype.hooks = function(name, suites, fn) {
|
|
13538
|
+
Runner.prototype.hooks = function (name, suites, fn) {
|
|
13593
13539
|
var self = this;
|
|
13594
13540
|
var orig = this.suite;
|
|
13595
13541
|
|
|
@@ -13601,7 +13547,7 @@
|
|
|
13601
13547
|
return fn();
|
|
13602
13548
|
}
|
|
13603
13549
|
|
|
13604
|
-
self.hook(name, function(err) {
|
|
13550
|
+
self.hook(name, function (err) {
|
|
13605
13551
|
if (err) {
|
|
13606
13552
|
var errSuite = self.suite;
|
|
13607
13553
|
self.suite = orig;
|
|
@@ -13622,7 +13568,7 @@
|
|
|
13622
13568
|
* @param {Function} fn
|
|
13623
13569
|
* @private
|
|
13624
13570
|
*/
|
|
13625
|
-
Runner.prototype.hookUp = function(name, fn) {
|
|
13571
|
+
Runner.prototype.hookUp = function (name, fn) {
|
|
13626
13572
|
var suites = [this.suite].concat(this.parents()).reverse();
|
|
13627
13573
|
this.hooks(name, suites, fn);
|
|
13628
13574
|
};
|
|
@@ -13634,7 +13580,7 @@
|
|
|
13634
13580
|
* @param {Function} fn
|
|
13635
13581
|
* @private
|
|
13636
13582
|
*/
|
|
13637
|
-
Runner.prototype.hookDown = function(name, fn) {
|
|
13583
|
+
Runner.prototype.hookDown = function (name, fn) {
|
|
13638
13584
|
var suites = [this.suite].concat(this.parents());
|
|
13639
13585
|
this.hooks(name, suites, fn);
|
|
13640
13586
|
};
|
|
@@ -13646,7 +13592,7 @@
|
|
|
13646
13592
|
* @return {Array}
|
|
13647
13593
|
* @private
|
|
13648
13594
|
*/
|
|
13649
|
-
Runner.prototype.parents = function() {
|
|
13595
|
+
Runner.prototype.parents = function () {
|
|
13650
13596
|
var suite = this.suite;
|
|
13651
13597
|
var suites = [];
|
|
13652
13598
|
while (suite.parent) {
|
|
@@ -13662,7 +13608,7 @@
|
|
|
13662
13608
|
* @param {Function} fn
|
|
13663
13609
|
* @private
|
|
13664
13610
|
*/
|
|
13665
|
-
Runner.prototype.runTest = function(fn) {
|
|
13611
|
+
Runner.prototype.runTest = function (fn) {
|
|
13666
13612
|
if (this._opts.dryRun) return fn();
|
|
13667
13613
|
|
|
13668
13614
|
var self = this;
|
|
@@ -13675,7 +13621,7 @@
|
|
|
13675
13621
|
if (this.asyncOnly) {
|
|
13676
13622
|
test.asyncOnly = true;
|
|
13677
13623
|
}
|
|
13678
|
-
this._addEventListener(test, 'error', function(err) {
|
|
13624
|
+
this._addEventListener(test, 'error', function (err) {
|
|
13679
13625
|
self.fail(test, err);
|
|
13680
13626
|
});
|
|
13681
13627
|
if (this.allowUncaught) {
|
|
@@ -13696,7 +13642,7 @@
|
|
|
13696
13642
|
* @param {Suite} suite
|
|
13697
13643
|
* @param {Function} fn
|
|
13698
13644
|
*/
|
|
13699
|
-
Runner.prototype.runTests = function(suite, fn) {
|
|
13645
|
+
Runner.prototype.runTests = function (suite, fn) {
|
|
13700
13646
|
var self = this;
|
|
13701
13647
|
var tests = suite.tests.slice();
|
|
13702
13648
|
var test;
|
|
@@ -13710,7 +13656,7 @@
|
|
|
13710
13656
|
self.suite = after ? errSuite.parent : errSuite;
|
|
13711
13657
|
|
|
13712
13658
|
if (self.suite) {
|
|
13713
|
-
self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
|
|
13659
|
+
self.hookUp(HOOK_TYPE_AFTER_EACH, function (err2, errSuite2) {
|
|
13714
13660
|
self.suite = orig;
|
|
13715
13661
|
// some hooks may fail even now
|
|
13716
13662
|
if (err2) {
|
|
@@ -13784,7 +13730,7 @@
|
|
|
13784
13730
|
|
|
13785
13731
|
// execute test and hook(s)
|
|
13786
13732
|
self.emit(constants$1.EVENT_TEST_BEGIN, (self.test = test));
|
|
13787
|
-
self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
|
|
13733
|
+
self.hookDown(HOOK_TYPE_BEFORE_EACH, function (err, errSuite) {
|
|
13788
13734
|
// conditional skip within beforeEach
|
|
13789
13735
|
if (test.isPending()) {
|
|
13790
13736
|
if (self.forbidPending) {
|
|
@@ -13797,7 +13743,7 @@
|
|
|
13797
13743
|
// skip inner afterEach hooks below errSuite level
|
|
13798
13744
|
var origSuite = self.suite;
|
|
13799
13745
|
self.suite = errSuite || self.suite;
|
|
13800
|
-
return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
|
|
13746
|
+
return self.hookUp(HOOK_TYPE_AFTER_EACH, function (e, eSuite) {
|
|
13801
13747
|
self.suite = origSuite;
|
|
13802
13748
|
next(e, eSuite);
|
|
13803
13749
|
});
|
|
@@ -13806,7 +13752,7 @@
|
|
|
13806
13752
|
return hookErr(err, errSuite, false);
|
|
13807
13753
|
}
|
|
13808
13754
|
self.currentRunnable = self.test;
|
|
13809
|
-
self.runTest(function(err) {
|
|
13755
|
+
self.runTest(function (err) {
|
|
13810
13756
|
test = self.test;
|
|
13811
13757
|
// conditional skip within it
|
|
13812
13758
|
if (test.pending) {
|
|
@@ -13857,7 +13803,7 @@
|
|
|
13857
13803
|
* @param {Suite} suite
|
|
13858
13804
|
* @param {Function} fn
|
|
13859
13805
|
*/
|
|
13860
|
-
Runner.prototype.runSuite = function(suite, fn) {
|
|
13806
|
+
Runner.prototype.runSuite = function (suite, fn) {
|
|
13861
13807
|
var i = 0;
|
|
13862
13808
|
var self = this;
|
|
13863
13809
|
var total = this.grepTotal(suite);
|
|
@@ -13897,7 +13843,7 @@
|
|
|
13897
13843
|
// huge recursive loop and thus a maximum call stack error.
|
|
13898
13844
|
// See comment in `this.runTests()` for more information.
|
|
13899
13845
|
if (self._grep !== self._defaultGrep) {
|
|
13900
|
-
Runner.immediately(function() {
|
|
13846
|
+
Runner.immediately(function () {
|
|
13901
13847
|
self.runSuite(curr, next);
|
|
13902
13848
|
});
|
|
13903
13849
|
} else {
|
|
@@ -13912,7 +13858,7 @@
|
|
|
13912
13858
|
// remove reference to test
|
|
13913
13859
|
delete self.test;
|
|
13914
13860
|
|
|
13915
|
-
self.hook(HOOK_TYPE_AFTER_ALL, function() {
|
|
13861
|
+
self.hook(HOOK_TYPE_AFTER_ALL, function () {
|
|
13916
13862
|
self.emit(constants$1.EVENT_SUITE_END, suite);
|
|
13917
13863
|
fn(errSuite);
|
|
13918
13864
|
});
|
|
@@ -13920,7 +13866,7 @@
|
|
|
13920
13866
|
|
|
13921
13867
|
this.nextSuite = next;
|
|
13922
13868
|
|
|
13923
|
-
this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
|
|
13869
|
+
this.hook(HOOK_TYPE_BEFORE_ALL, function (err) {
|
|
13924
13870
|
if (err) {
|
|
13925
13871
|
return done();
|
|
13926
13872
|
}
|
|
@@ -13944,7 +13890,7 @@
|
|
|
13944
13890
|
* @param {Error} err - Some uncaught error
|
|
13945
13891
|
* @private
|
|
13946
13892
|
*/
|
|
13947
|
-
Runner.prototype._uncaught = function(err) {
|
|
13893
|
+
Runner.prototype._uncaught = function (err) {
|
|
13948
13894
|
// this is defensive to prevent future developers from mis-calling this function.
|
|
13949
13895
|
// it's more likely that it'd be called with the incorrect context--say, the global
|
|
13950
13896
|
// `process` object--than it would to be called with a context that is not a "subclass"
|
|
@@ -14042,12 +13988,12 @@
|
|
|
14042
13988
|
* @param {{files: string[], options: Options}} [opts] - For subclasses
|
|
14043
13989
|
* @returns {Runner} Runner instance.
|
|
14044
13990
|
*/
|
|
14045
|
-
Runner.prototype.run = function(fn, opts = {}) {
|
|
13991
|
+
Runner.prototype.run = function (fn, opts = {}) {
|
|
14046
13992
|
var rootSuite = this.suite;
|
|
14047
13993
|
var options = opts.options || {};
|
|
14048
13994
|
|
|
14049
13995
|
debug('run(): got options: %O', options);
|
|
14050
|
-
fn = fn || function() {};
|
|
13996
|
+
fn = fn || function () {};
|
|
14051
13997
|
|
|
14052
13998
|
const end = () => {
|
|
14053
13999
|
if (!this.total && this._opts.failZero) this.failures = 1;
|
|
@@ -14088,7 +14034,7 @@
|
|
|
14088
14034
|
}
|
|
14089
14035
|
|
|
14090
14036
|
// callback
|
|
14091
|
-
this.on(constants$1.EVENT_RUN_END, function() {
|
|
14037
|
+
this.on(constants$1.EVENT_RUN_END, function () {
|
|
14092
14038
|
this.state = constants$1.STATE_STOPPED;
|
|
14093
14039
|
debug('run(): emitted %s', constants$1.EVENT_RUN_END);
|
|
14094
14040
|
fn(this.failures);
|
|
@@ -14135,7 +14081,7 @@
|
|
|
14135
14081
|
* }
|
|
14136
14082
|
* }
|
|
14137
14083
|
*/
|
|
14138
|
-
Runner.prototype.linkPartialObjects = function(value) {
|
|
14084
|
+
Runner.prototype.linkPartialObjects = function (value) {
|
|
14139
14085
|
return this;
|
|
14140
14086
|
};
|
|
14141
14087
|
|
|
@@ -14160,7 +14106,7 @@
|
|
|
14160
14106
|
* @public
|
|
14161
14107
|
* @return {Runner} Runner instance.
|
|
14162
14108
|
*/
|
|
14163
|
-
Runner.prototype.abort = function() {
|
|
14109
|
+
Runner.prototype.abort = function () {
|
|
14164
14110
|
debug('abort(): aborting');
|
|
14165
14111
|
this._abort = true;
|
|
14166
14112
|
|
|
@@ -14188,7 +14134,7 @@
|
|
|
14188
14134
|
* @chainable
|
|
14189
14135
|
* @abstract
|
|
14190
14136
|
*/
|
|
14191
|
-
Runner.prototype.workerReporter = function() {
|
|
14137
|
+
Runner.prototype.workerReporter = function () {
|
|
14192
14138
|
throw createUnsupportedError$1('workerReporter() not supported in serial mode');
|
|
14193
14139
|
};
|
|
14194
14140
|
|
|
@@ -14201,7 +14147,7 @@
|
|
|
14201
14147
|
* @return {Array}
|
|
14202
14148
|
*/
|
|
14203
14149
|
function filterLeaks(ok, globals) {
|
|
14204
|
-
return globals.filter(function(key) {
|
|
14150
|
+
return globals.filter(function (key) {
|
|
14205
14151
|
// Firefox and Chrome exposes iframes as index inside the window object
|
|
14206
14152
|
if (/^\d+/.test(key)) {
|
|
14207
14153
|
return false;
|
|
@@ -14225,7 +14171,7 @@
|
|
|
14225
14171
|
return false;
|
|
14226
14172
|
}
|
|
14227
14173
|
|
|
14228
|
-
var matched = ok.filter(function(ok) {
|
|
14174
|
+
var matched = ok.filter(function (ok) {
|
|
14229
14175
|
if (~ok.indexOf('*')) {
|
|
14230
14176
|
return key.indexOf(ok.split('*')[0]) === 0;
|
|
14231
14177
|
}
|
|
@@ -14273,7 +14219,7 @@
|
|
|
14273
14219
|
|
|
14274
14220
|
var runner = Runner;
|
|
14275
14221
|
|
|
14276
|
-
var require$$
|
|
14222
|
+
var require$$10 = getCjsExportFromNamespace(_nodeResolve_empty$1);
|
|
14277
14223
|
|
|
14278
14224
|
var base = createCommonjsModule(function (module, exports) {
|
|
14279
14225
|
/**
|
|
@@ -14325,7 +14271,7 @@
|
|
|
14325
14271
|
|
|
14326
14272
|
exports.useColors =
|
|
14327
14273
|
!isBrowser &&
|
|
14328
|
-
(require$$
|
|
14274
|
+
(require$$10.stdout || process$1.env.MOCHA_COLORS !== undefined);
|
|
14329
14275
|
|
|
14330
14276
|
/**
|
|
14331
14277
|
* Inline diffs instead of +/-
|
|
@@ -14384,7 +14330,7 @@
|
|
|
14384
14330
|
* @param {string} str
|
|
14385
14331
|
* @return {string}
|
|
14386
14332
|
*/
|
|
14387
|
-
var color = (exports.color = function(type, str) {
|
|
14333
|
+
var color = (exports.color = function (type, str) {
|
|
14388
14334
|
if (!exports.useColors) {
|
|
14389
14335
|
return String(str);
|
|
14390
14336
|
}
|
|
@@ -14412,23 +14358,23 @@
|
|
|
14412
14358
|
*/
|
|
14413
14359
|
|
|
14414
14360
|
exports.cursor = {
|
|
14415
|
-
hide: function() {
|
|
14361
|
+
hide: function () {
|
|
14416
14362
|
isatty && process$1.stdout.write('\u001b[?25l');
|
|
14417
14363
|
},
|
|
14418
14364
|
|
|
14419
|
-
show: function() {
|
|
14365
|
+
show: function () {
|
|
14420
14366
|
isatty && process$1.stdout.write('\u001b[?25h');
|
|
14421
14367
|
},
|
|
14422
14368
|
|
|
14423
|
-
deleteLine: function() {
|
|
14369
|
+
deleteLine: function () {
|
|
14424
14370
|
isatty && process$1.stdout.write('\u001b[2K');
|
|
14425
14371
|
},
|
|
14426
14372
|
|
|
14427
|
-
beginningOfLine: function() {
|
|
14373
|
+
beginningOfLine: function () {
|
|
14428
14374
|
isatty && process$1.stdout.write('\u001b[0G');
|
|
14429
14375
|
},
|
|
14430
14376
|
|
|
14431
|
-
CR: function() {
|
|
14377
|
+
CR: function () {
|
|
14432
14378
|
if (isatty) {
|
|
14433
14379
|
exports.cursor.deleteLine();
|
|
14434
14380
|
exports.cursor.beginningOfLine();
|
|
@@ -14438,7 +14384,7 @@
|
|
|
14438
14384
|
}
|
|
14439
14385
|
};
|
|
14440
14386
|
|
|
14441
|
-
var showDiff = (exports.showDiff = function(err) {
|
|
14387
|
+
var showDiff = (exports.showDiff = function (err) {
|
|
14442
14388
|
return (
|
|
14443
14389
|
err &&
|
|
14444
14390
|
err.showDiff !== false &&
|
|
@@ -14465,7 +14411,7 @@
|
|
|
14465
14411
|
* @param {string} expected
|
|
14466
14412
|
* @return {string} Diff
|
|
14467
14413
|
*/
|
|
14468
|
-
var generateDiff = (exports.generateDiff = function(actual, expected) {
|
|
14414
|
+
var generateDiff = (exports.generateDiff = function (actual, expected) {
|
|
14469
14415
|
try {
|
|
14470
14416
|
const diffSize = 2048;
|
|
14471
14417
|
if (actual.length > diffSize) {
|
|
@@ -14497,10 +14443,10 @@
|
|
|
14497
14443
|
* @param {Object[]} failures - Each is Test instance with corresponding
|
|
14498
14444
|
* Error property
|
|
14499
14445
|
*/
|
|
14500
|
-
exports.list = function(failures) {
|
|
14446
|
+
exports.list = function (failures) {
|
|
14501
14447
|
var multipleErr, multipleTest;
|
|
14502
14448
|
Base.consoleLog();
|
|
14503
|
-
failures.forEach(function(test, i) {
|
|
14449
|
+
failures.forEach(function (test, i) {
|
|
14504
14450
|
// format
|
|
14505
14451
|
var fmt =
|
|
14506
14452
|
color('error title', ' %s) %s:\n') +
|
|
@@ -14559,7 +14505,7 @@
|
|
|
14559
14505
|
|
|
14560
14506
|
// indented test title
|
|
14561
14507
|
var testTitle = '';
|
|
14562
|
-
test.titlePath().forEach(function(str, index) {
|
|
14508
|
+
test.titlePath().forEach(function (str, index) {
|
|
14563
14509
|
if (index !== 0) {
|
|
14564
14510
|
testTitle += '\n ';
|
|
14565
14511
|
}
|
|
@@ -14595,7 +14541,7 @@
|
|
|
14595
14541
|
this.runner = runner;
|
|
14596
14542
|
this.stats = runner.stats; // assigned so Reporters keep a closer reference
|
|
14597
14543
|
|
|
14598
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
14544
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
14599
14545
|
if (test.duration > test.slow()) {
|
|
14600
14546
|
test.speed = 'slow';
|
|
14601
14547
|
} else if (test.duration > test.slow() / 2) {
|
|
@@ -14605,7 +14551,7 @@
|
|
|
14605
14551
|
}
|
|
14606
14552
|
});
|
|
14607
14553
|
|
|
14608
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
14554
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
14609
14555
|
if (showDiff(err)) {
|
|
14610
14556
|
stringifyDiffObjs(err);
|
|
14611
14557
|
}
|
|
@@ -14625,7 +14571,7 @@
|
|
|
14625
14571
|
* @public
|
|
14626
14572
|
* @memberof Mocha.reporters
|
|
14627
14573
|
*/
|
|
14628
|
-
Base.prototype.epilogue = function() {
|
|
14574
|
+
Base.prototype.epilogue = function () {
|
|
14629
14575
|
var stats = this.stats;
|
|
14630
14576
|
var fmt;
|
|
14631
14577
|
|
|
@@ -14688,7 +14634,7 @@
|
|
|
14688
14634
|
if (lines.length > 4) {
|
|
14689
14635
|
var width = String(lines.length).length;
|
|
14690
14636
|
msg = lines
|
|
14691
|
-
.map(function(str, i) {
|
|
14637
|
+
.map(function (str, i) {
|
|
14692
14638
|
return pad(++i, width) + ' |' + ' ' + str;
|
|
14693
14639
|
})
|
|
14694
14640
|
.join('\n');
|
|
@@ -14745,10 +14691,7 @@
|
|
|
14745
14691
|
' ' +
|
|
14746
14692
|
colorLines('diff removed', '- actual') +
|
|
14747
14693
|
'\n\n' +
|
|
14748
|
-
lines
|
|
14749
|
-
.map(cleanUp)
|
|
14750
|
-
.filter(notBlank)
|
|
14751
|
-
.join('\n')
|
|
14694
|
+
lines.map(cleanUp).filter(notBlank).join('\n')
|
|
14752
14695
|
);
|
|
14753
14696
|
}
|
|
14754
14697
|
|
|
@@ -14763,7 +14706,7 @@
|
|
|
14763
14706
|
function errorDiff(actual, expected) {
|
|
14764
14707
|
return diff$1
|
|
14765
14708
|
.diffWordsWithSpace(actual, expected)
|
|
14766
|
-
.map(function(str) {
|
|
14709
|
+
.map(function (str) {
|
|
14767
14710
|
if (str.added) {
|
|
14768
14711
|
return colorLines('diff added inline', str.value);
|
|
14769
14712
|
}
|
|
@@ -14786,7 +14729,7 @@
|
|
|
14786
14729
|
function colorLines(name, str) {
|
|
14787
14730
|
return str
|
|
14788
14731
|
.split('\n')
|
|
14789
|
-
.map(function(str) {
|
|
14732
|
+
.map(function (str) {
|
|
14790
14733
|
return color(name, str);
|
|
14791
14734
|
})
|
|
14792
14735
|
.join('\n');
|
|
@@ -14854,18 +14797,18 @@
|
|
|
14854
14797
|
var width = (base.window.width * 0.75) | 0;
|
|
14855
14798
|
var n = -1;
|
|
14856
14799
|
|
|
14857
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
14800
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
14858
14801
|
process$1.stdout.write('\n');
|
|
14859
14802
|
});
|
|
14860
14803
|
|
|
14861
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
14804
|
+
runner.on(EVENT_TEST_PENDING, function () {
|
|
14862
14805
|
if (++n % width === 0) {
|
|
14863
14806
|
process$1.stdout.write('\n ');
|
|
14864
14807
|
}
|
|
14865
14808
|
process$1.stdout.write(base.color('pending', base.symbols.comma));
|
|
14866
14809
|
});
|
|
14867
14810
|
|
|
14868
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
14811
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
14869
14812
|
if (++n % width === 0) {
|
|
14870
14813
|
process$1.stdout.write('\n ');
|
|
14871
14814
|
}
|
|
@@ -14876,14 +14819,14 @@
|
|
|
14876
14819
|
}
|
|
14877
14820
|
});
|
|
14878
14821
|
|
|
14879
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
14822
|
+
runner.on(EVENT_TEST_FAIL, function () {
|
|
14880
14823
|
if (++n % width === 0) {
|
|
14881
14824
|
process$1.stdout.write('\n ');
|
|
14882
14825
|
}
|
|
14883
14826
|
process$1.stdout.write(base.color('fail', base.symbols.bang));
|
|
14884
14827
|
});
|
|
14885
14828
|
|
|
14886
|
-
runner.once(EVENT_RUN_END, function() {
|
|
14829
|
+
runner.once(EVENT_RUN_END, function () {
|
|
14887
14830
|
process$1.stdout.write('\n');
|
|
14888
14831
|
self.epilogue();
|
|
14889
14832
|
});
|
|
@@ -14938,7 +14881,7 @@
|
|
|
14938
14881
|
return Array(indents).join(' ');
|
|
14939
14882
|
}
|
|
14940
14883
|
|
|
14941
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
14884
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
14942
14885
|
if (suite.root) {
|
|
14943
14886
|
return;
|
|
14944
14887
|
}
|
|
@@ -14949,7 +14892,7 @@
|
|
|
14949
14892
|
base.consoleLog('%s<dl>', indent());
|
|
14950
14893
|
});
|
|
14951
14894
|
|
|
14952
|
-
runner.on(EVENT_SUITE_END, function(suite) {
|
|
14895
|
+
runner.on(EVENT_SUITE_END, function (suite) {
|
|
14953
14896
|
if (suite.root) {
|
|
14954
14897
|
return;
|
|
14955
14898
|
}
|
|
@@ -14959,14 +14902,14 @@
|
|
|
14959
14902
|
--indents;
|
|
14960
14903
|
});
|
|
14961
14904
|
|
|
14962
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
14905
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
14963
14906
|
base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
|
|
14964
14907
|
base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.file));
|
|
14965
14908
|
var code = utils.escape(utils.clean(test.body));
|
|
14966
14909
|
base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
|
|
14967
14910
|
});
|
|
14968
14911
|
|
|
14969
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
14912
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
14970
14913
|
base.consoleLog(
|
|
14971
14914
|
'%s <dt class="error">%s</dt>',
|
|
14972
14915
|
indent(),
|
|
@@ -15045,27 +14988,27 @@
|
|
|
15045
14988
|
|
|
15046
14989
|
this._producer = createProducer(tapVersion);
|
|
15047
14990
|
|
|
15048
|
-
runner.once(EVENT_RUN_BEGIN, function() {
|
|
14991
|
+
runner.once(EVENT_RUN_BEGIN, function () {
|
|
15049
14992
|
self._producer.writeVersion();
|
|
15050
14993
|
});
|
|
15051
14994
|
|
|
15052
|
-
runner.on(EVENT_TEST_END, function() {
|
|
14995
|
+
runner.on(EVENT_TEST_END, function () {
|
|
15053
14996
|
++n;
|
|
15054
14997
|
});
|
|
15055
14998
|
|
|
15056
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
14999
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15057
15000
|
self._producer.writePending(n, test);
|
|
15058
15001
|
});
|
|
15059
15002
|
|
|
15060
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15003
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15061
15004
|
self._producer.writePass(n, test);
|
|
15062
15005
|
});
|
|
15063
15006
|
|
|
15064
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
15007
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
15065
15008
|
self._producer.writeFail(n, test, err);
|
|
15066
15009
|
});
|
|
15067
15010
|
|
|
15068
|
-
runner.once(EVENT_RUN_END, function() {
|
|
15011
|
+
runner.once(EVENT_RUN_END, function () {
|
|
15069
15012
|
self._producer.writeEpilogue(runner.stats);
|
|
15070
15013
|
});
|
|
15071
15014
|
}
|
|
@@ -15109,8 +15052,8 @@
|
|
|
15109
15052
|
*/
|
|
15110
15053
|
function createProducer(tapVersion) {
|
|
15111
15054
|
var producers = {
|
|
15112
|
-
|
|
15113
|
-
|
|
15055
|
+
12: new TAP12Producer(),
|
|
15056
|
+
13: new TAP13Producer()
|
|
15114
15057
|
};
|
|
15115
15058
|
var producer = producers[tapVersion];
|
|
15116
15059
|
|
|
@@ -15140,7 +15083,7 @@
|
|
|
15140
15083
|
*
|
|
15141
15084
|
* @abstract
|
|
15142
15085
|
*/
|
|
15143
|
-
TAPProducer.prototype.writeVersion = function() {};
|
|
15086
|
+
TAPProducer.prototype.writeVersion = function () {};
|
|
15144
15087
|
|
|
15145
15088
|
/**
|
|
15146
15089
|
* Writes the plan to reporter output stream.
|
|
@@ -15148,7 +15091,7 @@
|
|
|
15148
15091
|
* @abstract
|
|
15149
15092
|
* @param {number} ntests - Number of tests that are planned to run.
|
|
15150
15093
|
*/
|
|
15151
|
-
TAPProducer.prototype.writePlan = function(ntests) {
|
|
15094
|
+
TAPProducer.prototype.writePlan = function (ntests) {
|
|
15152
15095
|
println('%d..%d', 1, ntests);
|
|
15153
15096
|
};
|
|
15154
15097
|
|
|
@@ -15159,7 +15102,7 @@
|
|
|
15159
15102
|
* @param {number} n - Index of test that passed.
|
|
15160
15103
|
* @param {Test} test - Instance containing test information.
|
|
15161
15104
|
*/
|
|
15162
|
-
TAPProducer.prototype.writePass = function(n, test) {
|
|
15105
|
+
TAPProducer.prototype.writePass = function (n, test) {
|
|
15163
15106
|
println('ok %d %s', n, title(test));
|
|
15164
15107
|
};
|
|
15165
15108
|
|
|
@@ -15170,7 +15113,7 @@
|
|
|
15170
15113
|
* @param {number} n - Index of test that was skipped.
|
|
15171
15114
|
* @param {Test} test - Instance containing test information.
|
|
15172
15115
|
*/
|
|
15173
|
-
TAPProducer.prototype.writePending = function(n, test) {
|
|
15116
|
+
TAPProducer.prototype.writePending = function (n, test) {
|
|
15174
15117
|
println('ok %d %s # SKIP -', n, title(test));
|
|
15175
15118
|
};
|
|
15176
15119
|
|
|
@@ -15182,7 +15125,7 @@
|
|
|
15182
15125
|
* @param {Test} test - Instance containing test information.
|
|
15183
15126
|
* @param {Error} err - Reason the test failed.
|
|
15184
15127
|
*/
|
|
15185
|
-
TAPProducer.prototype.writeFail = function(n, test, err) {
|
|
15128
|
+
TAPProducer.prototype.writeFail = function (n, test, err) {
|
|
15186
15129
|
println('not ok %d %s', n, title(test));
|
|
15187
15130
|
};
|
|
15188
15131
|
|
|
@@ -15192,7 +15135,7 @@
|
|
|
15192
15135
|
* @abstract
|
|
15193
15136
|
* @param {Object} stats - Object containing run statistics.
|
|
15194
15137
|
*/
|
|
15195
|
-
TAPProducer.prototype.writeEpilogue = function(stats) {
|
|
15138
|
+
TAPProducer.prototype.writeEpilogue = function (stats) {
|
|
15196
15139
|
// :TBD: Why is this not counting pending tests?
|
|
15197
15140
|
println('# tests ' + (stats.passes + stats.failures));
|
|
15198
15141
|
println('# pass ' + stats.passes);
|
|
@@ -15218,7 +15161,7 @@
|
|
|
15218
15161
|
* Writes that test failed to reporter output stream, with error formatting.
|
|
15219
15162
|
* @override
|
|
15220
15163
|
*/
|
|
15221
|
-
this.writeFail = function(n, test, err) {
|
|
15164
|
+
this.writeFail = function (n, test, err) {
|
|
15222
15165
|
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
15223
15166
|
if (err.message) {
|
|
15224
15167
|
println(err.message.replace(/^/gm, ' '));
|
|
@@ -15251,7 +15194,7 @@
|
|
|
15251
15194
|
* Writes the TAP version to reporter output stream.
|
|
15252
15195
|
* @override
|
|
15253
15196
|
*/
|
|
15254
|
-
this.writeVersion = function() {
|
|
15197
|
+
this.writeVersion = function () {
|
|
15255
15198
|
println('TAP version 13');
|
|
15256
15199
|
};
|
|
15257
15200
|
|
|
@@ -15259,7 +15202,7 @@
|
|
|
15259
15202
|
* Writes that test failed to reporter output stream, with error formatting.
|
|
15260
15203
|
* @override
|
|
15261
15204
|
*/
|
|
15262
|
-
this.writeFail = function(n, test, err) {
|
|
15205
|
+
this.writeFail = function (n, test, err) {
|
|
15263
15206
|
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
15264
15207
|
var emitYamlBlock = err.message != null || err.stack != null;
|
|
15265
15208
|
if (emitYamlBlock) {
|
|
@@ -15344,23 +15287,23 @@
|
|
|
15344
15287
|
output = options.reporterOption.output;
|
|
15345
15288
|
}
|
|
15346
15289
|
|
|
15347
|
-
runner.on(EVENT_TEST_END, function(test) {
|
|
15290
|
+
runner.on(EVENT_TEST_END, function (test) {
|
|
15348
15291
|
tests.push(test);
|
|
15349
15292
|
});
|
|
15350
15293
|
|
|
15351
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15294
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15352
15295
|
passes.push(test);
|
|
15353
15296
|
});
|
|
15354
15297
|
|
|
15355
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
15298
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
15356
15299
|
failures.push(test);
|
|
15357
15300
|
});
|
|
15358
15301
|
|
|
15359
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15302
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15360
15303
|
pending.push(test);
|
|
15361
15304
|
});
|
|
15362
15305
|
|
|
15363
|
-
runner.once(EVENT_RUN_END, function() {
|
|
15306
|
+
runner.once(EVENT_RUN_END, function () {
|
|
15364
15307
|
var obj = {
|
|
15365
15308
|
stats: self.stats,
|
|
15366
15309
|
tests: tests.map(clean),
|
|
@@ -15423,7 +15366,7 @@
|
|
|
15423
15366
|
function cleanCycles(obj) {
|
|
15424
15367
|
var cache = [];
|
|
15425
15368
|
return JSON.parse(
|
|
15426
|
-
JSON.stringify(obj, function(key, value) {
|
|
15369
|
+
JSON.stringify(obj, function (key, value) {
|
|
15427
15370
|
if (typeof value === 'object' && value !== null) {
|
|
15428
15371
|
if (cache.indexOf(value) !== -1) {
|
|
15429
15372
|
// Instead of going in a circle, we'll print [object Object]
|
|
@@ -15446,7 +15389,7 @@
|
|
|
15446
15389
|
*/
|
|
15447
15390
|
function errorJSON(err) {
|
|
15448
15391
|
var res = {};
|
|
15449
|
-
Object.getOwnPropertyNames(err).forEach(function(key) {
|
|
15392
|
+
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
15450
15393
|
res[key] = err[key];
|
|
15451
15394
|
}, err);
|
|
15452
15395
|
return res;
|
|
@@ -15482,7 +15425,7 @@
|
|
|
15482
15425
|
* @param {number} size
|
|
15483
15426
|
* @return {Progress} Progress instance.
|
|
15484
15427
|
*/
|
|
15485
|
-
Progress.prototype.size = function(size) {
|
|
15428
|
+
Progress.prototype.size = function (size) {
|
|
15486
15429
|
this._size = size;
|
|
15487
15430
|
return this;
|
|
15488
15431
|
};
|
|
@@ -15494,7 +15437,7 @@
|
|
|
15494
15437
|
* @param {string} text
|
|
15495
15438
|
* @return {Progress} Progress instance.
|
|
15496
15439
|
*/
|
|
15497
|
-
Progress.prototype.text = function(text) {
|
|
15440
|
+
Progress.prototype.text = function (text) {
|
|
15498
15441
|
this._text = text;
|
|
15499
15442
|
return this;
|
|
15500
15443
|
};
|
|
@@ -15506,7 +15449,7 @@
|
|
|
15506
15449
|
* @param {number} size
|
|
15507
15450
|
* @return {Progress} Progress instance.
|
|
15508
15451
|
*/
|
|
15509
|
-
Progress.prototype.fontSize = function(size) {
|
|
15452
|
+
Progress.prototype.fontSize = function (size) {
|
|
15510
15453
|
this._fontSize = size;
|
|
15511
15454
|
return this;
|
|
15512
15455
|
};
|
|
@@ -15517,7 +15460,7 @@
|
|
|
15517
15460
|
* @param {string} family
|
|
15518
15461
|
* @return {Progress} Progress instance.
|
|
15519
15462
|
*/
|
|
15520
|
-
Progress.prototype.font = function(family) {
|
|
15463
|
+
Progress.prototype.font = function (family) {
|
|
15521
15464
|
this._font = family;
|
|
15522
15465
|
return this;
|
|
15523
15466
|
};
|
|
@@ -15528,7 +15471,7 @@
|
|
|
15528
15471
|
* @param {number} n
|
|
15529
15472
|
* @return {Progress} Progress instance.
|
|
15530
15473
|
*/
|
|
15531
|
-
Progress.prototype.update = function(n) {
|
|
15474
|
+
Progress.prototype.update = function (n) {
|
|
15532
15475
|
this.percent = n;
|
|
15533
15476
|
return this;
|
|
15534
15477
|
};
|
|
@@ -15539,7 +15482,7 @@
|
|
|
15539
15482
|
* @param {CanvasRenderingContext2d} ctx
|
|
15540
15483
|
* @return {Progress} Progress instance.
|
|
15541
15484
|
*/
|
|
15542
|
-
Progress.prototype.draw = function(ctx) {
|
|
15485
|
+
Progress.prototype.draw = function (ctx) {
|
|
15543
15486
|
try {
|
|
15544
15487
|
var percent = Math.min(this.percent, 100);
|
|
15545
15488
|
var size = this._size;
|
|
@@ -15670,7 +15613,7 @@
|
|
|
15670
15613
|
}
|
|
15671
15614
|
|
|
15672
15615
|
// pass toggle
|
|
15673
|
-
on(passesLink, 'click', function(evt) {
|
|
15616
|
+
on(passesLink, 'click', function (evt) {
|
|
15674
15617
|
evt.preventDefault();
|
|
15675
15618
|
unhide();
|
|
15676
15619
|
var name = /pass/.test(report.className) ? '' : ' pass';
|
|
@@ -15681,7 +15624,7 @@
|
|
|
15681
15624
|
});
|
|
15682
15625
|
|
|
15683
15626
|
// failure toggle
|
|
15684
|
-
on(failuresLink, 'click', function(evt) {
|
|
15627
|
+
on(failuresLink, 'click', function (evt) {
|
|
15685
15628
|
evt.preventDefault();
|
|
15686
15629
|
unhide();
|
|
15687
15630
|
var name = /fail/.test(report.className) ? '' : ' fail';
|
|
@@ -15698,7 +15641,7 @@
|
|
|
15698
15641
|
progress.size(40);
|
|
15699
15642
|
}
|
|
15700
15643
|
|
|
15701
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
15644
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
15702
15645
|
if (suite.root) {
|
|
15703
15646
|
return;
|
|
15704
15647
|
}
|
|
@@ -15717,7 +15660,7 @@
|
|
|
15717
15660
|
el.appendChild(stack[0]);
|
|
15718
15661
|
});
|
|
15719
15662
|
|
|
15720
|
-
runner.on(EVENT_SUITE_END, function(suite) {
|
|
15663
|
+
runner.on(EVENT_SUITE_END, function (suite) {
|
|
15721
15664
|
if (suite.root) {
|
|
15722
15665
|
updateStats();
|
|
15723
15666
|
return;
|
|
@@ -15725,7 +15668,7 @@
|
|
|
15725
15668
|
stack.shift();
|
|
15726
15669
|
});
|
|
15727
15670
|
|
|
15728
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15671
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15729
15672
|
var url = self.testURL(test);
|
|
15730
15673
|
var markup =
|
|
15731
15674
|
'<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
|
|
@@ -15738,7 +15681,7 @@
|
|
|
15738
15681
|
updateStats();
|
|
15739
15682
|
});
|
|
15740
15683
|
|
|
15741
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
15684
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
15742
15685
|
var el = fragment(
|
|
15743
15686
|
'<li class="test fail"><h2>%e <a href="%e" class="replay">' +
|
|
15744
15687
|
playIcon +
|
|
@@ -15794,7 +15737,7 @@
|
|
|
15794
15737
|
updateStats();
|
|
15795
15738
|
});
|
|
15796
15739
|
|
|
15797
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15740
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15798
15741
|
var el = fragment(
|
|
15799
15742
|
'<li class="test pass pending"><h2>%e</h2></li>',
|
|
15800
15743
|
test.title
|
|
@@ -15852,7 +15795,7 @@
|
|
|
15852
15795
|
*
|
|
15853
15796
|
* @param {Object} [suite]
|
|
15854
15797
|
*/
|
|
15855
|
-
HTML.prototype.suiteURL = function(suite) {
|
|
15798
|
+
HTML.prototype.suiteURL = function (suite) {
|
|
15856
15799
|
return makeUrl(suite.fullTitle());
|
|
15857
15800
|
};
|
|
15858
15801
|
|
|
@@ -15861,7 +15804,7 @@
|
|
|
15861
15804
|
*
|
|
15862
15805
|
* @param {Object} [test]
|
|
15863
15806
|
*/
|
|
15864
|
-
HTML.prototype.testURL = function(test) {
|
|
15807
|
+
HTML.prototype.testURL = function (test) {
|
|
15865
15808
|
return makeUrl(test.fullTitle());
|
|
15866
15809
|
};
|
|
15867
15810
|
|
|
@@ -15871,10 +15814,10 @@
|
|
|
15871
15814
|
* @param {HTMLLIElement} el
|
|
15872
15815
|
* @param {string} contents
|
|
15873
15816
|
*/
|
|
15874
|
-
HTML.prototype.addCodeToggle = function(el, contents) {
|
|
15817
|
+
HTML.prototype.addCodeToggle = function (el, contents) {
|
|
15875
15818
|
var h2 = el.getElementsByTagName('h2')[0];
|
|
15876
15819
|
|
|
15877
|
-
on(h2, 'click', function() {
|
|
15820
|
+
on(h2, 'click', function () {
|
|
15878
15821
|
pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
|
|
15879
15822
|
});
|
|
15880
15823
|
|
|
@@ -15902,7 +15845,7 @@
|
|
|
15902
15845
|
var div = document.createElement('div');
|
|
15903
15846
|
var i = 1;
|
|
15904
15847
|
|
|
15905
|
-
div.innerHTML = html.replace(/%([se])/g, function(_, type) {
|
|
15848
|
+
div.innerHTML = html.replace(/%([se])/g, function (_, type) {
|
|
15906
15849
|
switch (type) {
|
|
15907
15850
|
case 's':
|
|
15908
15851
|
return String(args[i++]);
|
|
@@ -16011,20 +15954,20 @@
|
|
|
16011
15954
|
var self = this;
|
|
16012
15955
|
var n = 0;
|
|
16013
15956
|
|
|
16014
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
15957
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16015
15958
|
base.consoleLog();
|
|
16016
15959
|
});
|
|
16017
15960
|
|
|
16018
|
-
runner.on(EVENT_TEST_BEGIN, function(test) {
|
|
15961
|
+
runner.on(EVENT_TEST_BEGIN, function (test) {
|
|
16019
15962
|
process$1.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
|
|
16020
15963
|
});
|
|
16021
15964
|
|
|
16022
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15965
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
16023
15966
|
var fmt = color('checkmark', ' -') + color('pending', ' %s');
|
|
16024
15967
|
base.consoleLog(fmt, test.fullTitle());
|
|
16025
15968
|
});
|
|
16026
15969
|
|
|
16027
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15970
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16028
15971
|
var fmt =
|
|
16029
15972
|
color('checkmark', ' ' + base.symbols.ok) +
|
|
16030
15973
|
color('pass', ' %s: ') +
|
|
@@ -16033,7 +15976,7 @@
|
|
|
16033
15976
|
base.consoleLog(fmt, test.fullTitle(), test.duration);
|
|
16034
15977
|
});
|
|
16035
15978
|
|
|
16036
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
15979
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
16037
15980
|
cursor.CR();
|
|
16038
15981
|
base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
|
|
16039
15982
|
});
|
|
@@ -16085,7 +16028,7 @@
|
|
|
16085
16028
|
function Min(runner, options) {
|
|
16086
16029
|
base.call(this, runner, options);
|
|
16087
16030
|
|
|
16088
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16031
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16089
16032
|
// clear screen
|
|
16090
16033
|
process$1.stdout.write('\u001b[2J');
|
|
16091
16034
|
// set cursor position
|
|
@@ -16150,28 +16093,28 @@
|
|
|
16150
16093
|
return Array(indents).join(' ');
|
|
16151
16094
|
}
|
|
16152
16095
|
|
|
16153
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16096
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16154
16097
|
base.consoleLog();
|
|
16155
16098
|
});
|
|
16156
16099
|
|
|
16157
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
16100
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
16158
16101
|
++indents;
|
|
16159
16102
|
base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
|
|
16160
16103
|
});
|
|
16161
16104
|
|
|
16162
|
-
runner.on(EVENT_SUITE_END, function() {
|
|
16105
|
+
runner.on(EVENT_SUITE_END, function () {
|
|
16163
16106
|
--indents;
|
|
16164
16107
|
if (indents === 1) {
|
|
16165
16108
|
base.consoleLog();
|
|
16166
16109
|
}
|
|
16167
16110
|
});
|
|
16168
16111
|
|
|
16169
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
16112
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
16170
16113
|
var fmt = indent() + color('pending', ' - %s');
|
|
16171
16114
|
base.consoleLog(fmt, test.title);
|
|
16172
16115
|
});
|
|
16173
16116
|
|
|
16174
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
16117
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16175
16118
|
var fmt;
|
|
16176
16119
|
if (test.speed === 'fast') {
|
|
16177
16120
|
fmt =
|
|
@@ -16189,7 +16132,7 @@
|
|
|
16189
16132
|
}
|
|
16190
16133
|
});
|
|
16191
16134
|
|
|
16192
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
16135
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
16193
16136
|
base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
|
|
16194
16137
|
});
|
|
16195
16138
|
|
|
@@ -16252,24 +16195,24 @@
|
|
|
16252
16195
|
this.trajectories = [[], [], [], []];
|
|
16253
16196
|
this.trajectoryWidthMax = width - nyanCatWidth;
|
|
16254
16197
|
|
|
16255
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16198
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16256
16199
|
base.cursor.hide();
|
|
16257
16200
|
self.draw();
|
|
16258
16201
|
});
|
|
16259
16202
|
|
|
16260
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
16203
|
+
runner.on(EVENT_TEST_PENDING, function () {
|
|
16261
16204
|
self.draw();
|
|
16262
16205
|
});
|
|
16263
16206
|
|
|
16264
|
-
runner.on(EVENT_TEST_PASS, function() {
|
|
16207
|
+
runner.on(EVENT_TEST_PASS, function () {
|
|
16265
16208
|
self.draw();
|
|
16266
16209
|
});
|
|
16267
16210
|
|
|
16268
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
16211
|
+
runner.on(EVENT_TEST_FAIL, function () {
|
|
16269
16212
|
self.draw();
|
|
16270
16213
|
});
|
|
16271
16214
|
|
|
16272
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16215
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16273
16216
|
base.cursor.show();
|
|
16274
16217
|
for (var i = 0; i < self.numberOfLines; i++) {
|
|
16275
16218
|
write('\n');
|
|
@@ -16289,7 +16232,7 @@
|
|
|
16289
16232
|
* @private
|
|
16290
16233
|
*/
|
|
16291
16234
|
|
|
16292
|
-
NyanCat.prototype.draw = function() {
|
|
16235
|
+
NyanCat.prototype.draw = function () {
|
|
16293
16236
|
this.appendRainbow();
|
|
16294
16237
|
this.drawScoreboard();
|
|
16295
16238
|
this.drawRainbow();
|
|
@@ -16304,7 +16247,7 @@
|
|
|
16304
16247
|
* @private
|
|
16305
16248
|
*/
|
|
16306
16249
|
|
|
16307
|
-
NyanCat.prototype.drawScoreboard = function() {
|
|
16250
|
+
NyanCat.prototype.drawScoreboard = function () {
|
|
16308
16251
|
var stats = this.stats;
|
|
16309
16252
|
|
|
16310
16253
|
function draw(type, n) {
|
|
@@ -16327,7 +16270,7 @@
|
|
|
16327
16270
|
* @private
|
|
16328
16271
|
*/
|
|
16329
16272
|
|
|
16330
|
-
NyanCat.prototype.appendRainbow = function() {
|
|
16273
|
+
NyanCat.prototype.appendRainbow = function () {
|
|
16331
16274
|
var segment = this.tick ? '_' : '-';
|
|
16332
16275
|
var rainbowified = this.rainbowify(segment);
|
|
16333
16276
|
|
|
@@ -16346,10 +16289,10 @@
|
|
|
16346
16289
|
* @private
|
|
16347
16290
|
*/
|
|
16348
16291
|
|
|
16349
|
-
NyanCat.prototype.drawRainbow = function() {
|
|
16292
|
+
NyanCat.prototype.drawRainbow = function () {
|
|
16350
16293
|
var self = this;
|
|
16351
16294
|
|
|
16352
|
-
this.trajectories.forEach(function(line) {
|
|
16295
|
+
this.trajectories.forEach(function (line) {
|
|
16353
16296
|
write('\u001b[' + self.scoreboardWidth + 'C');
|
|
16354
16297
|
write(line.join(''));
|
|
16355
16298
|
write('\n');
|
|
@@ -16363,7 +16306,7 @@
|
|
|
16363
16306
|
*
|
|
16364
16307
|
* @private
|
|
16365
16308
|
*/
|
|
16366
|
-
NyanCat.prototype.drawNyanCat = function() {
|
|
16309
|
+
NyanCat.prototype.drawNyanCat = function () {
|
|
16367
16310
|
var self = this;
|
|
16368
16311
|
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
|
16369
16312
|
var dist = '\u001b[' + startWidth + 'C';
|
|
@@ -16399,7 +16342,7 @@
|
|
|
16399
16342
|
* @return {string}
|
|
16400
16343
|
*/
|
|
16401
16344
|
|
|
16402
|
-
NyanCat.prototype.face = function() {
|
|
16345
|
+
NyanCat.prototype.face = function () {
|
|
16403
16346
|
var stats = this.stats;
|
|
16404
16347
|
if (stats.failures) {
|
|
16405
16348
|
return '( x .x)';
|
|
@@ -16418,7 +16361,7 @@
|
|
|
16418
16361
|
* @param {number} n
|
|
16419
16362
|
*/
|
|
16420
16363
|
|
|
16421
|
-
NyanCat.prototype.cursorUp = function(n) {
|
|
16364
|
+
NyanCat.prototype.cursorUp = function (n) {
|
|
16422
16365
|
write('\u001b[' + n + 'A');
|
|
16423
16366
|
};
|
|
16424
16367
|
|
|
@@ -16429,7 +16372,7 @@
|
|
|
16429
16372
|
* @param {number} n
|
|
16430
16373
|
*/
|
|
16431
16374
|
|
|
16432
|
-
NyanCat.prototype.cursorDown = function(n) {
|
|
16375
|
+
NyanCat.prototype.cursorDown = function (n) {
|
|
16433
16376
|
write('\u001b[' + n + 'B');
|
|
16434
16377
|
};
|
|
16435
16378
|
|
|
@@ -16439,7 +16382,7 @@
|
|
|
16439
16382
|
* @private
|
|
16440
16383
|
* @return {Array}
|
|
16441
16384
|
*/
|
|
16442
|
-
NyanCat.prototype.generateColors = function() {
|
|
16385
|
+
NyanCat.prototype.generateColors = function () {
|
|
16443
16386
|
var colors = [];
|
|
16444
16387
|
|
|
16445
16388
|
for (var i = 0; i < 6 * 7; i++) {
|
|
@@ -16461,7 +16404,7 @@
|
|
|
16461
16404
|
* @param {string} str
|
|
16462
16405
|
* @return {string}
|
|
16463
16406
|
*/
|
|
16464
|
-
NyanCat.prototype.rainbowify = function(str) {
|
|
16407
|
+
NyanCat.prototype.rainbowify = function (str) {
|
|
16465
16408
|
if (!base.useColors) {
|
|
16466
16409
|
return str;
|
|
16467
16410
|
}
|
|
@@ -16553,19 +16496,19 @@
|
|
|
16553
16496
|
// fall back to the default suite name
|
|
16554
16497
|
suiteName = suiteName || DEFAULT_SUITE_NAME;
|
|
16555
16498
|
|
|
16556
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
16499
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
16557
16500
|
tests.push(test);
|
|
16558
16501
|
});
|
|
16559
16502
|
|
|
16560
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
16503
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16561
16504
|
tests.push(test);
|
|
16562
16505
|
});
|
|
16563
16506
|
|
|
16564
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
16507
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
16565
16508
|
tests.push(test);
|
|
16566
16509
|
});
|
|
16567
16510
|
|
|
16568
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16511
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16569
16512
|
self.write(
|
|
16570
16513
|
tag(
|
|
16571
16514
|
'testsuite',
|
|
@@ -16582,7 +16525,7 @@
|
|
|
16582
16525
|
)
|
|
16583
16526
|
);
|
|
16584
16527
|
|
|
16585
|
-
tests.forEach(function(t) {
|
|
16528
|
+
tests.forEach(function (t) {
|
|
16586
16529
|
self.test(t);
|
|
16587
16530
|
});
|
|
16588
16531
|
|
|
@@ -16601,9 +16544,9 @@
|
|
|
16601
16544
|
* @param failures
|
|
16602
16545
|
* @param {Function} fn
|
|
16603
16546
|
*/
|
|
16604
|
-
XUnit.prototype.done = function(failures, fn) {
|
|
16547
|
+
XUnit.prototype.done = function (failures, fn) {
|
|
16605
16548
|
if (this.fileStream) {
|
|
16606
|
-
this.fileStream.end(function() {
|
|
16549
|
+
this.fileStream.end(function () {
|
|
16607
16550
|
fn(failures);
|
|
16608
16551
|
});
|
|
16609
16552
|
} else {
|
|
@@ -16616,7 +16559,7 @@
|
|
|
16616
16559
|
*
|
|
16617
16560
|
* @param {string} line
|
|
16618
16561
|
*/
|
|
16619
|
-
XUnit.prototype.write = function(line) {
|
|
16562
|
+
XUnit.prototype.write = function (line) {
|
|
16620
16563
|
if (this.fileStream) {
|
|
16621
16564
|
this.fileStream.write(line + '\n');
|
|
16622
16565
|
} else if (typeof process$1 === 'object' && process$1.stdout) {
|
|
@@ -16631,7 +16574,7 @@
|
|
|
16631
16574
|
*
|
|
16632
16575
|
* @param {Test} test
|
|
16633
16576
|
*/
|
|
16634
|
-
XUnit.prototype.test = function(test) {
|
|
16577
|
+
XUnit.prototype.test = function (test) {
|
|
16635
16578
|
base.useColors = false;
|
|
16636
16579
|
|
|
16637
16580
|
var attrs = {
|
|
@@ -16749,7 +16692,7 @@
|
|
|
16749
16692
|
var key = SUITE_PREFIX + suite.title;
|
|
16750
16693
|
|
|
16751
16694
|
obj = obj[key] = obj[key] || {suite: suite};
|
|
16752
|
-
suite.suites.forEach(function(suite) {
|
|
16695
|
+
suite.suites.forEach(function (suite) {
|
|
16753
16696
|
mapTOC(suite, obj);
|
|
16754
16697
|
});
|
|
16755
16698
|
|
|
@@ -16781,18 +16724,18 @@
|
|
|
16781
16724
|
|
|
16782
16725
|
generateTOC(runner.suite);
|
|
16783
16726
|
|
|
16784
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
16727
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
16785
16728
|
++level;
|
|
16786
16729
|
var slug = utils.slug(suite.fullTitle());
|
|
16787
16730
|
buf += '<a name="' + slug + '"></a>' + '\n';
|
|
16788
16731
|
buf += title(suite.title) + '\n';
|
|
16789
16732
|
});
|
|
16790
16733
|
|
|
16791
|
-
runner.on(EVENT_SUITE_END, function() {
|
|
16734
|
+
runner.on(EVENT_SUITE_END, function () {
|
|
16792
16735
|
--level;
|
|
16793
16736
|
});
|
|
16794
16737
|
|
|
16795
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
16738
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16796
16739
|
var code = utils.clean(test.body);
|
|
16797
16740
|
buf += test.title + '.\n';
|
|
16798
16741
|
buf += '\n```js\n';
|
|
@@ -16800,7 +16743,7 @@
|
|
|
16800
16743
|
buf += '```\n\n';
|
|
16801
16744
|
});
|
|
16802
16745
|
|
|
16803
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16746
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16804
16747
|
process$1.stdout.write('# TOC\n');
|
|
16805
16748
|
process$1.stdout.write(generateTOC(runner.suite));
|
|
16806
16749
|
process$1.stdout.write(buf);
|
|
@@ -16869,13 +16812,13 @@
|
|
|
16869
16812
|
options.verbose = reporterOptions.verbose || false;
|
|
16870
16813
|
|
|
16871
16814
|
// tests started
|
|
16872
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16815
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16873
16816
|
process$1.stdout.write('\n');
|
|
16874
16817
|
cursor.hide();
|
|
16875
16818
|
});
|
|
16876
16819
|
|
|
16877
16820
|
// tests complete
|
|
16878
|
-
runner.on(EVENT_TEST_END, function() {
|
|
16821
|
+
runner.on(EVENT_TEST_END, function () {
|
|
16879
16822
|
complete++;
|
|
16880
16823
|
|
|
16881
16824
|
var percent = complete / total;
|
|
@@ -16901,7 +16844,7 @@
|
|
|
16901
16844
|
|
|
16902
16845
|
// tests are complete, output some stats
|
|
16903
16846
|
// and the failures if any
|
|
16904
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16847
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16905
16848
|
cursor.show();
|
|
16906
16849
|
process$1.stdout.write('\n');
|
|
16907
16850
|
self.epilogue();
|
|
@@ -16986,12 +16929,12 @@
|
|
|
16986
16929
|
return ' ' + color('runway', buf);
|
|
16987
16930
|
}
|
|
16988
16931
|
|
|
16989
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16932
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16990
16933
|
stream.write('\n\n\n ');
|
|
16991
16934
|
cursor.hide();
|
|
16992
16935
|
});
|
|
16993
16936
|
|
|
16994
|
-
runner.on(EVENT_TEST_END, function(test) {
|
|
16937
|
+
runner.on(EVENT_TEST_END, function (test) {
|
|
16995
16938
|
// check if the plane crashed
|
|
16996
16939
|
var col = crashed === -1 ? ((width * ++n) / ++total) | 0 : crashed;
|
|
16997
16940
|
// show the crash
|
|
@@ -17011,16 +16954,16 @@
|
|
|
17011
16954
|
stream.write('\u001b[0m');
|
|
17012
16955
|
});
|
|
17013
16956
|
|
|
17014
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16957
|
+
runner.once(EVENT_RUN_END, function () {
|
|
17015
16958
|
cursor.show();
|
|
17016
16959
|
process$1.stdout.write('\n');
|
|
17017
16960
|
self.epilogue();
|
|
17018
16961
|
});
|
|
17019
16962
|
|
|
17020
16963
|
// if cursor is hidden when we ctrl-C, then it will remain hidden unless...
|
|
17021
|
-
process$1.once('SIGINT', function() {
|
|
16964
|
+
process$1.once('SIGINT', function () {
|
|
17022
16965
|
cursor.show();
|
|
17023
|
-
nextTick$1(function() {
|
|
16966
|
+
nextTick$1(function () {
|
|
17024
16967
|
process$1.kill(process$1.pid, 'SIGINT');
|
|
17025
16968
|
});
|
|
17026
16969
|
});
|
|
@@ -17071,22 +17014,22 @@
|
|
|
17071
17014
|
var self = this;
|
|
17072
17015
|
var total = runner.total;
|
|
17073
17016
|
|
|
17074
|
-
runner.once(EVENT_RUN_BEGIN, function() {
|
|
17017
|
+
runner.once(EVENT_RUN_BEGIN, function () {
|
|
17075
17018
|
writeEvent(['start', {total: total}]);
|
|
17076
17019
|
});
|
|
17077
17020
|
|
|
17078
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
17021
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
17079
17022
|
writeEvent(['pass', clean(test)]);
|
|
17080
17023
|
});
|
|
17081
17024
|
|
|
17082
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
17025
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
17083
17026
|
test = clean(test);
|
|
17084
17027
|
test.err = err.message;
|
|
17085
17028
|
test.stack = err.stack || null;
|
|
17086
17029
|
writeEvent(['fail', test]);
|
|
17087
17030
|
});
|
|
17088
17031
|
|
|
17089
|
-
runner.once(EVENT_RUN_END, function() {
|
|
17032
|
+
runner.once(EVENT_RUN_END, function () {
|
|
17090
17033
|
writeEvent(['end', self.stats]);
|
|
17091
17034
|
});
|
|
17092
17035
|
}
|
|
@@ -17150,7 +17093,7 @@
|
|
|
17150
17093
|
});
|
|
17151
17094
|
|
|
17152
17095
|
var name = "mocha";
|
|
17153
|
-
var version = "9.
|
|
17096
|
+
var version = "9.2.0";
|
|
17154
17097
|
var homepage = "https://mochajs.org/";
|
|
17155
17098
|
var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
|
|
17156
17099
|
var _package = {
|
|
@@ -17169,7 +17112,7 @@
|
|
|
17169
17112
|
'default': _package
|
|
17170
17113
|
});
|
|
17171
17114
|
|
|
17172
|
-
var require$$
|
|
17115
|
+
var require$$9 = getCjsExportFromNamespace(_package$1);
|
|
17173
17116
|
|
|
17174
17117
|
/**
|
|
17175
17118
|
* Web Notifications module.
|
|
@@ -17194,7 +17137,7 @@
|
|
|
17194
17137
|
* @see {@link Mocha#isGrowlCapable}
|
|
17195
17138
|
* @return {boolean} whether browser notification support exists
|
|
17196
17139
|
*/
|
|
17197
|
-
var isCapable = function() {
|
|
17140
|
+
var isCapable = function () {
|
|
17198
17141
|
var hasNotificationSupport = 'Notification' in window;
|
|
17199
17142
|
var hasPromiseSupport = typeof Promise === 'function';
|
|
17200
17143
|
return isBrowser() && hasNotificationSupport && hasPromiseSupport;
|
|
@@ -17210,17 +17153,17 @@
|
|
|
17210
17153
|
* @see {@link Mocha#_growl}
|
|
17211
17154
|
* @param {Runner} runner - Runner instance.
|
|
17212
17155
|
*/
|
|
17213
|
-
var notify = function(runner) {
|
|
17156
|
+
var notify = function (runner) {
|
|
17214
17157
|
var promise = isPermitted();
|
|
17215
17158
|
|
|
17216
17159
|
/**
|
|
17217
17160
|
* Attempt notification.
|
|
17218
17161
|
*/
|
|
17219
|
-
var sendNotification = function() {
|
|
17162
|
+
var sendNotification = function () {
|
|
17220
17163
|
// If user hasn't responded yet... "No notification for you!" (Seinfeld)
|
|
17221
17164
|
Promise.race([promise, Promise.resolve(undefined)])
|
|
17222
17165
|
.then(canNotify)
|
|
17223
|
-
.then(function() {
|
|
17166
|
+
.then(function () {
|
|
17224
17167
|
display(runner);
|
|
17225
17168
|
})
|
|
17226
17169
|
.catch(notPermitted);
|
|
@@ -17248,7 +17191,7 @@
|
|
|
17248
17191
|
return Promise.resolve(false);
|
|
17249
17192
|
},
|
|
17250
17193
|
default: function ask() {
|
|
17251
|
-
return Notification.requestPermission().then(function(permission) {
|
|
17194
|
+
return Notification.requestPermission().then(function (permission) {
|
|
17252
17195
|
return permission === 'granted';
|
|
17253
17196
|
});
|
|
17254
17197
|
}
|
|
@@ -17296,7 +17239,7 @@
|
|
|
17296
17239
|
cross: '\u274C',
|
|
17297
17240
|
tick: '\u2705'
|
|
17298
17241
|
};
|
|
17299
|
-
var logo = require$$
|
|
17242
|
+
var logo = require$$9.notifyLogo;
|
|
17300
17243
|
var _message;
|
|
17301
17244
|
var message;
|
|
17302
17245
|
var title;
|
|
@@ -17435,25 +17378,25 @@
|
|
|
17435
17378
|
|
|
17436
17379
|
runner.stats = stats;
|
|
17437
17380
|
|
|
17438
|
-
runner.once(EVENT_RUN_BEGIN, function() {
|
|
17381
|
+
runner.once(EVENT_RUN_BEGIN, function () {
|
|
17439
17382
|
stats.start = new Date$2();
|
|
17440
17383
|
});
|
|
17441
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
17384
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
17442
17385
|
suite.root || stats.suites++;
|
|
17443
17386
|
});
|
|
17444
|
-
runner.on(EVENT_TEST_PASS, function() {
|
|
17387
|
+
runner.on(EVENT_TEST_PASS, function () {
|
|
17445
17388
|
stats.passes++;
|
|
17446
17389
|
});
|
|
17447
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
17390
|
+
runner.on(EVENT_TEST_FAIL, function () {
|
|
17448
17391
|
stats.failures++;
|
|
17449
17392
|
});
|
|
17450
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
17393
|
+
runner.on(EVENT_TEST_PENDING, function () {
|
|
17451
17394
|
stats.pending++;
|
|
17452
17395
|
});
|
|
17453
|
-
runner.on(EVENT_TEST_END, function() {
|
|
17396
|
+
runner.on(EVENT_TEST_END, function () {
|
|
17454
17397
|
stats.tests++;
|
|
17455
17398
|
});
|
|
17456
|
-
runner.once(EVENT_RUN_END, function() {
|
|
17399
|
+
runner.once(EVENT_RUN_END, function () {
|
|
17457
17400
|
stats.end = new Date$2();
|
|
17458
17401
|
stats.duration = stats.end - stats.start;
|
|
17459
17402
|
});
|
|
@@ -17500,7 +17443,7 @@
|
|
|
17500
17443
|
/**
|
|
17501
17444
|
* Resets the state initially or for a next run.
|
|
17502
17445
|
*/
|
|
17503
|
-
Test.prototype.reset = function() {
|
|
17446
|
+
Test.prototype.reset = function () {
|
|
17504
17447
|
runnable.prototype.reset.call(this);
|
|
17505
17448
|
this.pending = !this.fn;
|
|
17506
17449
|
delete this.state;
|
|
@@ -17511,7 +17454,7 @@
|
|
|
17511
17454
|
*
|
|
17512
17455
|
* @private
|
|
17513
17456
|
*/
|
|
17514
|
-
Test.prototype.retriedTest = function(n) {
|
|
17457
|
+
Test.prototype.retriedTest = function (n) {
|
|
17515
17458
|
if (!arguments.length) {
|
|
17516
17459
|
return this._retriedTest;
|
|
17517
17460
|
}
|
|
@@ -17523,11 +17466,11 @@
|
|
|
17523
17466
|
*
|
|
17524
17467
|
* @private
|
|
17525
17468
|
*/
|
|
17526
|
-
Test.prototype.markOnly = function() {
|
|
17469
|
+
Test.prototype.markOnly = function () {
|
|
17527
17470
|
this.parent.appendOnlyTest(this);
|
|
17528
17471
|
};
|
|
17529
17472
|
|
|
17530
|
-
Test.prototype.clone = function() {
|
|
17473
|
+
Test.prototype.clone = function () {
|
|
17531
17474
|
var test = new Test(this.title, this.fn);
|
|
17532
17475
|
test.timeout(this.timeout());
|
|
17533
17476
|
test.slow(this.slow());
|
|
@@ -17590,7 +17533,7 @@
|
|
|
17590
17533
|
* @param {Mocha} mocha
|
|
17591
17534
|
* @return {Object} An object containing common functions.
|
|
17592
17535
|
*/
|
|
17593
|
-
var common = function(suites, context, mocha) {
|
|
17536
|
+
var common = function (suites, context, mocha) {
|
|
17594
17537
|
/**
|
|
17595
17538
|
* Check if the suite should be tested.
|
|
17596
17539
|
*
|
|
@@ -17627,7 +17570,7 @@
|
|
|
17627
17570
|
* @param {string} name
|
|
17628
17571
|
* @param {Function} fn
|
|
17629
17572
|
*/
|
|
17630
|
-
before: function(name, fn) {
|
|
17573
|
+
before: function (name, fn) {
|
|
17631
17574
|
suites[0].beforeAll(name, fn);
|
|
17632
17575
|
},
|
|
17633
17576
|
|
|
@@ -17637,7 +17580,7 @@
|
|
|
17637
17580
|
* @param {string} name
|
|
17638
17581
|
* @param {Function} fn
|
|
17639
17582
|
*/
|
|
17640
|
-
after: function(name, fn) {
|
|
17583
|
+
after: function (name, fn) {
|
|
17641
17584
|
suites[0].afterAll(name, fn);
|
|
17642
17585
|
},
|
|
17643
17586
|
|
|
@@ -17647,7 +17590,7 @@
|
|
|
17647
17590
|
* @param {string} name
|
|
17648
17591
|
* @param {Function} fn
|
|
17649
17592
|
*/
|
|
17650
|
-
beforeEach: function(name, fn) {
|
|
17593
|
+
beforeEach: function (name, fn) {
|
|
17651
17594
|
suites[0].beforeEach(name, fn);
|
|
17652
17595
|
},
|
|
17653
17596
|
|
|
@@ -17657,7 +17600,7 @@
|
|
|
17657
17600
|
* @param {string} name
|
|
17658
17601
|
* @param {Function} fn
|
|
17659
17602
|
*/
|
|
17660
|
-
afterEach: function(name, fn) {
|
|
17603
|
+
afterEach: function (name, fn) {
|
|
17661
17604
|
suites[0].afterEach(name, fn);
|
|
17662
17605
|
},
|
|
17663
17606
|
|
|
@@ -17743,7 +17686,7 @@
|
|
|
17743
17686
|
* @param {Function} test
|
|
17744
17687
|
* @returns {*}
|
|
17745
17688
|
*/
|
|
17746
|
-
only: function(mocha, test) {
|
|
17689
|
+
only: function (mocha, test) {
|
|
17747
17690
|
if (mocha.options.forbidOnly) {
|
|
17748
17691
|
throw createForbiddenExclusivityError(mocha);
|
|
17749
17692
|
}
|
|
@@ -17756,15 +17699,15 @@
|
|
|
17756
17699
|
*
|
|
17757
17700
|
* @param {string} title
|
|
17758
17701
|
*/
|
|
17759
|
-
skip: function(title) {
|
|
17702
|
+
skip: function (title) {
|
|
17760
17703
|
context.test(title);
|
|
17761
17704
|
}
|
|
17762
17705
|
}
|
|
17763
17706
|
};
|
|
17764
17707
|
};
|
|
17765
17708
|
|
|
17766
|
-
var EVENT_FILE_PRE_REQUIRE$2 =
|
|
17767
|
-
.EVENT_FILE_PRE_REQUIRE;
|
|
17709
|
+
var EVENT_FILE_PRE_REQUIRE$2 =
|
|
17710
|
+
suite.constants.EVENT_FILE_PRE_REQUIRE;
|
|
17768
17711
|
|
|
17769
17712
|
/**
|
|
17770
17713
|
* BDD-style interface:
|
|
@@ -17786,7 +17729,7 @@
|
|
|
17786
17729
|
var bdd$1 = function bddInterface(suite) {
|
|
17787
17730
|
var suites = [suite];
|
|
17788
17731
|
|
|
17789
|
-
suite.on(EVENT_FILE_PRE_REQUIRE$2, function(context, file, mocha) {
|
|
17732
|
+
suite.on(EVENT_FILE_PRE_REQUIRE$2, function (context, file, mocha) {
|
|
17790
17733
|
var common$1 = common(suites, context, mocha);
|
|
17791
17734
|
|
|
17792
17735
|
context.before = common$1.before;
|
|
@@ -17800,7 +17743,7 @@
|
|
|
17800
17743
|
* and/or tests.
|
|
17801
17744
|
*/
|
|
17802
17745
|
|
|
17803
|
-
context.describe = context.context = function(title, fn) {
|
|
17746
|
+
context.describe = context.context = function (title, fn) {
|
|
17804
17747
|
return common$1.suite.create({
|
|
17805
17748
|
title: title,
|
|
17806
17749
|
file: file,
|
|
@@ -17812,22 +17755,22 @@
|
|
|
17812
17755
|
* Pending describe.
|
|
17813
17756
|
*/
|
|
17814
17757
|
|
|
17815
|
-
context.xdescribe =
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17758
|
+
context.xdescribe =
|
|
17759
|
+
context.xcontext =
|
|
17760
|
+
context.describe.skip =
|
|
17761
|
+
function (title, fn) {
|
|
17762
|
+
return common$1.suite.skip({
|
|
17763
|
+
title: title,
|
|
17764
|
+
file: file,
|
|
17765
|
+
fn: fn
|
|
17766
|
+
});
|
|
17767
|
+
};
|
|
17825
17768
|
|
|
17826
17769
|
/**
|
|
17827
17770
|
* Exclusive suite.
|
|
17828
17771
|
*/
|
|
17829
17772
|
|
|
17830
|
-
context.describe.only = function(title, fn) {
|
|
17773
|
+
context.describe.only = function (title, fn) {
|
|
17831
17774
|
return common$1.suite.only({
|
|
17832
17775
|
title: title,
|
|
17833
17776
|
file: file,
|
|
@@ -17841,7 +17784,7 @@
|
|
|
17841
17784
|
* acting as a thunk.
|
|
17842
17785
|
*/
|
|
17843
17786
|
|
|
17844
|
-
context.it = context.specify = function(title, fn) {
|
|
17787
|
+
context.it = context.specify = function (title, fn) {
|
|
17845
17788
|
var suite = suites[0];
|
|
17846
17789
|
if (suite.isPending()) {
|
|
17847
17790
|
fn = null;
|
|
@@ -17856,7 +17799,7 @@
|
|
|
17856
17799
|
* Exclusive test-case.
|
|
17857
17800
|
*/
|
|
17858
17801
|
|
|
17859
|
-
context.it.only = function(title, fn) {
|
|
17802
|
+
context.it.only = function (title, fn) {
|
|
17860
17803
|
return common$1.test.only(mocha, context.it(title, fn));
|
|
17861
17804
|
};
|
|
17862
17805
|
|
|
@@ -17864,17 +17807,20 @@
|
|
|
17864
17807
|
* Pending test case.
|
|
17865
17808
|
*/
|
|
17866
17809
|
|
|
17867
|
-
context.xit =
|
|
17868
|
-
|
|
17869
|
-
|
|
17810
|
+
context.xit =
|
|
17811
|
+
context.xspecify =
|
|
17812
|
+
context.it.skip =
|
|
17813
|
+
function (title) {
|
|
17814
|
+
return context.it(title);
|
|
17815
|
+
};
|
|
17870
17816
|
});
|
|
17871
17817
|
};
|
|
17872
17818
|
|
|
17873
17819
|
var description$3 = 'BDD or RSpec style [default]';
|
|
17874
17820
|
bdd$1.description = description$3;
|
|
17875
17821
|
|
|
17876
|
-
var EVENT_FILE_PRE_REQUIRE$1 =
|
|
17877
|
-
.EVENT_FILE_PRE_REQUIRE;
|
|
17822
|
+
var EVENT_FILE_PRE_REQUIRE$1 =
|
|
17823
|
+
suite.constants.EVENT_FILE_PRE_REQUIRE;
|
|
17878
17824
|
|
|
17879
17825
|
/**
|
|
17880
17826
|
* TDD-style interface:
|
|
@@ -17901,10 +17847,10 @@
|
|
|
17901
17847
|
*
|
|
17902
17848
|
* @param {Suite} suite Root suite.
|
|
17903
17849
|
*/
|
|
17904
|
-
var tdd$1 = function(suite) {
|
|
17850
|
+
var tdd$1 = function (suite) {
|
|
17905
17851
|
var suites = [suite];
|
|
17906
17852
|
|
|
17907
|
-
suite.on(EVENT_FILE_PRE_REQUIRE$1, function(context, file, mocha) {
|
|
17853
|
+
suite.on(EVENT_FILE_PRE_REQUIRE$1, function (context, file, mocha) {
|
|
17908
17854
|
var common$1 = common(suites, context, mocha);
|
|
17909
17855
|
|
|
17910
17856
|
context.setup = common$1.beforeEach;
|
|
@@ -17917,7 +17863,7 @@
|
|
|
17917
17863
|
* Describe a "suite" with the given `title` and callback `fn` containing
|
|
17918
17864
|
* nested suites and/or tests.
|
|
17919
17865
|
*/
|
|
17920
|
-
context.suite = function(title, fn) {
|
|
17866
|
+
context.suite = function (title, fn) {
|
|
17921
17867
|
return common$1.suite.create({
|
|
17922
17868
|
title: title,
|
|
17923
17869
|
file: file,
|
|
@@ -17928,7 +17874,7 @@
|
|
|
17928
17874
|
/**
|
|
17929
17875
|
* Pending suite.
|
|
17930
17876
|
*/
|
|
17931
|
-
context.suite.skip = function(title, fn) {
|
|
17877
|
+
context.suite.skip = function (title, fn) {
|
|
17932
17878
|
return common$1.suite.skip({
|
|
17933
17879
|
title: title,
|
|
17934
17880
|
file: file,
|
|
@@ -17939,7 +17885,7 @@
|
|
|
17939
17885
|
/**
|
|
17940
17886
|
* Exclusive test-case.
|
|
17941
17887
|
*/
|
|
17942
|
-
context.suite.only = function(title, fn) {
|
|
17888
|
+
context.suite.only = function (title, fn) {
|
|
17943
17889
|
return common$1.suite.only({
|
|
17944
17890
|
title: title,
|
|
17945
17891
|
file: file,
|
|
@@ -17951,7 +17897,7 @@
|
|
|
17951
17897
|
* Describe a specification or test-case with the given `title` and
|
|
17952
17898
|
* callback `fn` acting as a thunk.
|
|
17953
17899
|
*/
|
|
17954
|
-
context.test = function(title, fn) {
|
|
17900
|
+
context.test = function (title, fn) {
|
|
17955
17901
|
var suite = suites[0];
|
|
17956
17902
|
if (suite.isPending()) {
|
|
17957
17903
|
fn = null;
|
|
@@ -17966,7 +17912,7 @@
|
|
|
17966
17912
|
* Exclusive test-case.
|
|
17967
17913
|
*/
|
|
17968
17914
|
|
|
17969
|
-
context.test.only = function(title, fn) {
|
|
17915
|
+
context.test.only = function (title, fn) {
|
|
17970
17916
|
return common$1.test.only(mocha, context.test(title, fn));
|
|
17971
17917
|
};
|
|
17972
17918
|
|
|
@@ -17978,8 +17924,8 @@
|
|
|
17978
17924
|
'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
|
|
17979
17925
|
tdd$1.description = description$2;
|
|
17980
17926
|
|
|
17981
|
-
var EVENT_FILE_PRE_REQUIRE =
|
|
17982
|
-
.EVENT_FILE_PRE_REQUIRE;
|
|
17927
|
+
var EVENT_FILE_PRE_REQUIRE =
|
|
17928
|
+
suite.constants.EVENT_FILE_PRE_REQUIRE;
|
|
17983
17929
|
|
|
17984
17930
|
/**
|
|
17985
17931
|
* QUnit-style interface:
|
|
@@ -18009,7 +17955,7 @@
|
|
|
18009
17955
|
var qunit$1 = function qUnitInterface(suite) {
|
|
18010
17956
|
var suites = [suite];
|
|
18011
17957
|
|
|
18012
|
-
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
17958
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function (context, file, mocha) {
|
|
18013
17959
|
var common$1 = common(suites, context, mocha);
|
|
18014
17960
|
|
|
18015
17961
|
context.before = common$1.before;
|
|
@@ -18021,7 +17967,7 @@
|
|
|
18021
17967
|
* Describe a "suite" with the given `title`.
|
|
18022
17968
|
*/
|
|
18023
17969
|
|
|
18024
|
-
context.suite = function(title) {
|
|
17970
|
+
context.suite = function (title) {
|
|
18025
17971
|
if (suites.length > 1) {
|
|
18026
17972
|
suites.shift();
|
|
18027
17973
|
}
|
|
@@ -18036,7 +17982,7 @@
|
|
|
18036
17982
|
* Exclusive Suite.
|
|
18037
17983
|
*/
|
|
18038
17984
|
|
|
18039
|
-
context.suite.only = function(title) {
|
|
17985
|
+
context.suite.only = function (title) {
|
|
18040
17986
|
if (suites.length > 1) {
|
|
18041
17987
|
suites.shift();
|
|
18042
17988
|
}
|
|
@@ -18053,7 +17999,7 @@
|
|
|
18053
17999
|
* acting as a thunk.
|
|
18054
18000
|
*/
|
|
18055
18001
|
|
|
18056
|
-
context.test = function(title, fn) {
|
|
18002
|
+
context.test = function (title, fn) {
|
|
18057
18003
|
var test$1 = new test(title, fn);
|
|
18058
18004
|
test$1.file = file;
|
|
18059
18005
|
suites[0].addTest(test$1);
|
|
@@ -18064,7 +18010,7 @@
|
|
|
18064
18010
|
* Exclusive test-case.
|
|
18065
18011
|
*/
|
|
18066
18012
|
|
|
18067
|
-
context.test.only = function(title, fn) {
|
|
18013
|
+
context.test.only = function (title, fn) {
|
|
18068
18014
|
return common$1.test.only(mocha, context.test(title, fn));
|
|
18069
18015
|
};
|
|
18070
18016
|
|
|
@@ -18092,7 +18038,7 @@
|
|
|
18092
18038
|
*
|
|
18093
18039
|
* @param {Suite} suite Root suite.
|
|
18094
18040
|
*/
|
|
18095
|
-
var exports$2 = function(suite$1) {
|
|
18041
|
+
var exports$2 = function (suite$1) {
|
|
18096
18042
|
var suites = [suite$1];
|
|
18097
18043
|
|
|
18098
18044
|
suite$1.on(suite.constants.EVENT_FILE_REQUIRE, visit);
|
|
@@ -18168,7 +18114,7 @@
|
|
|
18168
18114
|
* @param {Runnable} runnable
|
|
18169
18115
|
* @return {Context} context
|
|
18170
18116
|
*/
|
|
18171
|
-
Context.prototype.runnable = function(runnable) {
|
|
18117
|
+
Context.prototype.runnable = function (runnable) {
|
|
18172
18118
|
if (!arguments.length) {
|
|
18173
18119
|
return this._runnable;
|
|
18174
18120
|
}
|
|
@@ -18183,7 +18129,7 @@
|
|
|
18183
18129
|
* @param {number} ms
|
|
18184
18130
|
* @return {Context} self
|
|
18185
18131
|
*/
|
|
18186
|
-
Context.prototype.timeout = function(ms) {
|
|
18132
|
+
Context.prototype.timeout = function (ms) {
|
|
18187
18133
|
if (!arguments.length) {
|
|
18188
18134
|
return this.runnable().timeout();
|
|
18189
18135
|
}
|
|
@@ -18198,7 +18144,7 @@
|
|
|
18198
18144
|
* @param {number} ms
|
|
18199
18145
|
* @return {Context} self
|
|
18200
18146
|
*/
|
|
18201
|
-
Context.prototype.slow = function(ms) {
|
|
18147
|
+
Context.prototype.slow = function (ms) {
|
|
18202
18148
|
if (!arguments.length) {
|
|
18203
18149
|
return this.runnable().slow();
|
|
18204
18150
|
}
|
|
@@ -18212,7 +18158,7 @@
|
|
|
18212
18158
|
* @private
|
|
18213
18159
|
* @throws Pending
|
|
18214
18160
|
*/
|
|
18215
|
-
Context.prototype.skip = function() {
|
|
18161
|
+
Context.prototype.skip = function () {
|
|
18216
18162
|
this.runnable().skip();
|
|
18217
18163
|
};
|
|
18218
18164
|
|
|
@@ -18223,7 +18169,7 @@
|
|
|
18223
18169
|
* @param {number} n
|
|
18224
18170
|
* @return {Context} self
|
|
18225
18171
|
*/
|
|
18226
|
-
Context.prototype.retries = function(n) {
|
|
18172
|
+
Context.prototype.retries = function (n) {
|
|
18227
18173
|
if (!arguments.length) {
|
|
18228
18174
|
return this.runnable().retries();
|
|
18229
18175
|
}
|
|
@@ -18248,9 +18194,7 @@
|
|
|
18248
18194
|
|
|
18249
18195
|
|
|
18250
18196
|
|
|
18251
|
-
|
|
18252
|
-
? require$$11
|
|
18253
|
-
: undefined;
|
|
18197
|
+
|
|
18254
18198
|
|
|
18255
18199
|
const {
|
|
18256
18200
|
warn,
|
|
@@ -18260,11 +18204,8 @@
|
|
|
18260
18204
|
createMochaInstanceAlreadyRunningError,
|
|
18261
18205
|
createUnsupportedError
|
|
18262
18206
|
} = errors;
|
|
18263
|
-
const {
|
|
18264
|
-
|
|
18265
|
-
EVENT_FILE_POST_REQUIRE,
|
|
18266
|
-
EVENT_FILE_REQUIRE
|
|
18267
|
-
} = suite.constants;
|
|
18207
|
+
const {EVENT_FILE_PRE_REQUIRE, EVENT_FILE_POST_REQUIRE, EVENT_FILE_REQUIRE} =
|
|
18208
|
+
suite.constants;
|
|
18268
18209
|
var debug = browser('mocha:mocha');
|
|
18269
18210
|
|
|
18270
18211
|
exports = module.exports = Mocha;
|
|
@@ -18331,46 +18272,46 @@
|
|
|
18331
18272
|
exports.Test = test;
|
|
18332
18273
|
|
|
18333
18274
|
let currentContext;
|
|
18334
|
-
exports.afterEach = function(...args) {
|
|
18275
|
+
exports.afterEach = function (...args) {
|
|
18335
18276
|
return (currentContext.afterEach || currentContext.teardown).apply(
|
|
18336
18277
|
this,
|
|
18337
18278
|
args
|
|
18338
18279
|
);
|
|
18339
18280
|
};
|
|
18340
|
-
exports.after = function(...args) {
|
|
18281
|
+
exports.after = function (...args) {
|
|
18341
18282
|
return (currentContext.after || currentContext.suiteTeardown).apply(
|
|
18342
18283
|
this,
|
|
18343
18284
|
args
|
|
18344
18285
|
);
|
|
18345
18286
|
};
|
|
18346
|
-
exports.beforeEach = function(...args) {
|
|
18287
|
+
exports.beforeEach = function (...args) {
|
|
18347
18288
|
return (currentContext.beforeEach || currentContext.setup).apply(this, args);
|
|
18348
18289
|
};
|
|
18349
|
-
exports.before = function(...args) {
|
|
18290
|
+
exports.before = function (...args) {
|
|
18350
18291
|
return (currentContext.before || currentContext.suiteSetup).apply(this, args);
|
|
18351
18292
|
};
|
|
18352
|
-
exports.describe = function(...args) {
|
|
18293
|
+
exports.describe = function (...args) {
|
|
18353
18294
|
return (currentContext.describe || currentContext.suite).apply(this, args);
|
|
18354
18295
|
};
|
|
18355
|
-
exports.describe.only = function(...args) {
|
|
18296
|
+
exports.describe.only = function (...args) {
|
|
18356
18297
|
return (currentContext.describe || currentContext.suite).only.apply(
|
|
18357
18298
|
this,
|
|
18358
18299
|
args
|
|
18359
18300
|
);
|
|
18360
18301
|
};
|
|
18361
|
-
exports.describe.skip = function(...args) {
|
|
18302
|
+
exports.describe.skip = function (...args) {
|
|
18362
18303
|
return (currentContext.describe || currentContext.suite).skip.apply(
|
|
18363
18304
|
this,
|
|
18364
18305
|
args
|
|
18365
18306
|
);
|
|
18366
18307
|
};
|
|
18367
|
-
exports.it = function(...args) {
|
|
18308
|
+
exports.it = function (...args) {
|
|
18368
18309
|
return (currentContext.it || currentContext.test).apply(this, args);
|
|
18369
18310
|
};
|
|
18370
|
-
exports.it.only = function(...args) {
|
|
18311
|
+
exports.it.only = function (...args) {
|
|
18371
18312
|
return (currentContext.it || currentContext.test).only.apply(this, args);
|
|
18372
18313
|
};
|
|
18373
|
-
exports.it.skip = function(...args) {
|
|
18314
|
+
exports.it.skip = function (...args) {
|
|
18374
18315
|
return (currentContext.it || currentContext.test).skip.apply(this, args);
|
|
18375
18316
|
};
|
|
18376
18317
|
exports.xdescribe = exports.describe.skip;
|
|
@@ -18381,7 +18322,7 @@
|
|
|
18381
18322
|
exports.suite = exports.describe;
|
|
18382
18323
|
exports.teardown = exports.afterEach;
|
|
18383
18324
|
exports.test = exports.it;
|
|
18384
|
-
exports.run = function(...args) {
|
|
18325
|
+
exports.run = function (...args) {
|
|
18385
18326
|
return currentContext.run.apply(this, args);
|
|
18386
18327
|
};
|
|
18387
18328
|
|
|
@@ -18466,7 +18407,7 @@
|
|
|
18466
18407
|
'growl',
|
|
18467
18408
|
'inlineDiffs',
|
|
18468
18409
|
'invert'
|
|
18469
|
-
].forEach(function(opt) {
|
|
18410
|
+
].forEach(function (opt) {
|
|
18470
18411
|
if (options[opt]) {
|
|
18471
18412
|
this[opt]();
|
|
18472
18413
|
}
|
|
@@ -18524,7 +18465,7 @@
|
|
|
18524
18465
|
* @returns {Mocha} this
|
|
18525
18466
|
* @chainable
|
|
18526
18467
|
*/
|
|
18527
|
-
Mocha.prototype.bail = function(bail) {
|
|
18468
|
+
Mocha.prototype.bail = function (bail) {
|
|
18528
18469
|
this.suite.bail(bail !== false);
|
|
18529
18470
|
return this;
|
|
18530
18471
|
};
|
|
@@ -18542,7 +18483,7 @@
|
|
|
18542
18483
|
* @returns {Mocha} this
|
|
18543
18484
|
* @chainable
|
|
18544
18485
|
*/
|
|
18545
|
-
Mocha.prototype.addFile = function(file) {
|
|
18486
|
+
Mocha.prototype.addFile = function (file) {
|
|
18546
18487
|
this.files.push(file);
|
|
18547
18488
|
return this;
|
|
18548
18489
|
};
|
|
@@ -18563,7 +18504,7 @@
|
|
|
18563
18504
|
* // Use XUnit reporter and direct its output to file
|
|
18564
18505
|
* mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
|
|
18565
18506
|
*/
|
|
18566
|
-
Mocha.prototype.reporter = function(reporterName, reporterOptions) {
|
|
18507
|
+
Mocha.prototype.reporter = function (reporterName, reporterOptions) {
|
|
18567
18508
|
if (typeof reporterName === 'function') {
|
|
18568
18509
|
this._reporter = reporterName;
|
|
18569
18510
|
} else {
|
|
@@ -18619,7 +18560,7 @@
|
|
|
18619
18560
|
* @chainable
|
|
18620
18561
|
* @throws {Error} if requested interface cannot be loaded
|
|
18621
18562
|
*/
|
|
18622
|
-
Mocha.prototype.ui = function(ui) {
|
|
18563
|
+
Mocha.prototype.ui = function (ui) {
|
|
18623
18564
|
var bindInterface;
|
|
18624
18565
|
if (typeof ui === 'function') {
|
|
18625
18566
|
bindInterface = ui;
|
|
@@ -18636,7 +18577,7 @@
|
|
|
18636
18577
|
}
|
|
18637
18578
|
bindInterface(this.suite);
|
|
18638
18579
|
|
|
18639
|
-
this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
|
|
18580
|
+
this.suite.on(EVENT_FILE_PRE_REQUIRE, function (context) {
|
|
18640
18581
|
currentContext = context;
|
|
18641
18582
|
});
|
|
18642
18583
|
|
|
@@ -18658,10 +18599,10 @@
|
|
|
18658
18599
|
* @see {@link Mocha#loadFilesAsync}
|
|
18659
18600
|
* @param {Function} [fn] - Callback invoked upon completion.
|
|
18660
18601
|
*/
|
|
18661
|
-
Mocha.prototype.loadFiles = function(fn) {
|
|
18602
|
+
Mocha.prototype.loadFiles = function (fn) {
|
|
18662
18603
|
var self = this;
|
|
18663
18604
|
var suite = this.suite;
|
|
18664
|
-
this.files.forEach(function(file) {
|
|
18605
|
+
this.files.forEach(function (file) {
|
|
18665
18606
|
file = path.resolve(file);
|
|
18666
18607
|
suite.emit(EVENT_FILE_PRE_REQUIRE, commonjsGlobal, file, self);
|
|
18667
18608
|
suite.emit(EVENT_FILE_REQUIRE, commonjsRequire(), file, self);
|
|
@@ -18690,23 +18631,17 @@
|
|
|
18690
18631
|
* .then(() => mocha.run(failures => process.exitCode = failures ? 1 : 0))
|
|
18691
18632
|
* .catch(() => process.exitCode = 1);
|
|
18692
18633
|
*/
|
|
18693
|
-
Mocha.prototype.loadFilesAsync = function() {
|
|
18634
|
+
Mocha.prototype.loadFilesAsync = function () {
|
|
18694
18635
|
var self = this;
|
|
18695
18636
|
var suite = this.suite;
|
|
18696
18637
|
this.lazyLoadFiles(true);
|
|
18697
18638
|
|
|
18698
|
-
|
|
18699
|
-
return new Promise(function(resolve) {
|
|
18700
|
-
self.loadFiles(resolve);
|
|
18701
|
-
});
|
|
18702
|
-
}
|
|
18703
|
-
|
|
18704
|
-
return esmUtils.loadFilesAsync(
|
|
18639
|
+
return require$$10.loadFilesAsync(
|
|
18705
18640
|
this.files,
|
|
18706
|
-
function(file) {
|
|
18641
|
+
function (file) {
|
|
18707
18642
|
suite.emit(EVENT_FILE_PRE_REQUIRE, commonjsGlobal, file, self);
|
|
18708
18643
|
},
|
|
18709
|
-
function(file, resultModule) {
|
|
18644
|
+
function (file, resultModule) {
|
|
18710
18645
|
suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
|
|
18711
18646
|
suite.emit(EVENT_FILE_POST_REQUIRE, commonjsGlobal, file, self);
|
|
18712
18647
|
}
|
|
@@ -18721,13 +18656,13 @@
|
|
|
18721
18656
|
* @see {@link Mocha#unloadFiles}
|
|
18722
18657
|
* @param {string} file - Pathname of file to be unloaded.
|
|
18723
18658
|
*/
|
|
18724
|
-
Mocha.unloadFile = function(file) {
|
|
18659
|
+
Mocha.unloadFile = function (file) {
|
|
18725
18660
|
if (utils.isBrowser()) {
|
|
18726
18661
|
throw createUnsupportedError(
|
|
18727
18662
|
'unloadFile() is only suported in a Node.js environment'
|
|
18728
18663
|
);
|
|
18729
18664
|
}
|
|
18730
|
-
return require$$
|
|
18665
|
+
return require$$10.unloadFile(file);
|
|
18731
18666
|
};
|
|
18732
18667
|
|
|
18733
18668
|
/**
|
|
@@ -18745,7 +18680,7 @@
|
|
|
18745
18680
|
* @returns {Mocha} this
|
|
18746
18681
|
* @chainable
|
|
18747
18682
|
*/
|
|
18748
|
-
Mocha.prototype.unloadFiles = function() {
|
|
18683
|
+
Mocha.prototype.unloadFiles = function () {
|
|
18749
18684
|
if (this._state === mochaStates.DISPOSED) {
|
|
18750
18685
|
throw createMochaInstanceAlreadyDisposedError(
|
|
18751
18686
|
'Mocha instance is already disposed, it cannot be used again.',
|
|
@@ -18754,7 +18689,7 @@
|
|
|
18754
18689
|
);
|
|
18755
18690
|
}
|
|
18756
18691
|
|
|
18757
|
-
this.files.forEach(function(file) {
|
|
18692
|
+
this.files.forEach(function (file) {
|
|
18758
18693
|
Mocha.unloadFile(file);
|
|
18759
18694
|
});
|
|
18760
18695
|
this._state = mochaStates.INIT;
|
|
@@ -18774,7 +18709,7 @@
|
|
|
18774
18709
|
* // Select tests whose full title begins with `"foo"` followed by a period
|
|
18775
18710
|
* mocha.fgrep('foo.');
|
|
18776
18711
|
*/
|
|
18777
|
-
Mocha.prototype.fgrep = function(str) {
|
|
18712
|
+
Mocha.prototype.fgrep = function (str) {
|
|
18778
18713
|
if (!str) {
|
|
18779
18714
|
return this;
|
|
18780
18715
|
}
|
|
@@ -18815,7 +18750,7 @@
|
|
|
18815
18750
|
* // Given embedded test `it('only-this-test')`...
|
|
18816
18751
|
* mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
|
|
18817
18752
|
*/
|
|
18818
|
-
Mocha.prototype.grep = function(re) {
|
|
18753
|
+
Mocha.prototype.grep = function (re) {
|
|
18819
18754
|
if (utils.isString(re)) {
|
|
18820
18755
|
// extract args if it's regex-like, i.e: [string, pattern, flag]
|
|
18821
18756
|
var arg = re.match(/^\/(.*)\/([gimy]{0,4})$|.*/);
|
|
@@ -18838,7 +18773,7 @@
|
|
|
18838
18773
|
* // Select tests whose full title does *not* contain `"match"`, ignoring case
|
|
18839
18774
|
* mocha.grep(/match/i).invert();
|
|
18840
18775
|
*/
|
|
18841
|
-
Mocha.prototype.invert = function() {
|
|
18776
|
+
Mocha.prototype.invert = function () {
|
|
18842
18777
|
this.options.invert = true;
|
|
18843
18778
|
return this;
|
|
18844
18779
|
};
|
|
@@ -18852,7 +18787,7 @@
|
|
|
18852
18787
|
* @return {Mocha} this
|
|
18853
18788
|
* @chainable
|
|
18854
18789
|
*/
|
|
18855
|
-
Mocha.prototype.checkLeaks = function(checkLeaks) {
|
|
18790
|
+
Mocha.prototype.checkLeaks = function (checkLeaks) {
|
|
18856
18791
|
this.options.checkLeaks = checkLeaks !== false;
|
|
18857
18792
|
return this;
|
|
18858
18793
|
};
|
|
@@ -18867,7 +18802,7 @@
|
|
|
18867
18802
|
* @return {Mocha} this
|
|
18868
18803
|
* @chainable
|
|
18869
18804
|
*/
|
|
18870
|
-
Mocha.prototype.cleanReferencesAfterRun = function(cleanReferencesAfterRun) {
|
|
18805
|
+
Mocha.prototype.cleanReferencesAfterRun = function (cleanReferencesAfterRun) {
|
|
18871
18806
|
this._cleanReferencesAfterRun = cleanReferencesAfterRun !== false;
|
|
18872
18807
|
return this;
|
|
18873
18808
|
};
|
|
@@ -18877,7 +18812,7 @@
|
|
|
18877
18812
|
* It also removes function references to tests functions and hooks, so variables trapped in closures can be cleaned by the garbage collector.
|
|
18878
18813
|
* @public
|
|
18879
18814
|
*/
|
|
18880
|
-
Mocha.prototype.dispose = function() {
|
|
18815
|
+
Mocha.prototype.dispose = function () {
|
|
18881
18816
|
if (this._state === mochaStates.RUNNING) {
|
|
18882
18817
|
throw createMochaInstanceAlreadyRunningError(
|
|
18883
18818
|
'Cannot dispose while the mocha instance is still running tests.'
|
|
@@ -18898,7 +18833,7 @@
|
|
|
18898
18833
|
* @return {Mocha} this
|
|
18899
18834
|
* @chainable
|
|
18900
18835
|
*/
|
|
18901
|
-
Mocha.prototype.fullTrace = function(fullTrace) {
|
|
18836
|
+
Mocha.prototype.fullTrace = function (fullTrace) {
|
|
18902
18837
|
this.options.fullTrace = fullTrace !== false;
|
|
18903
18838
|
return this;
|
|
18904
18839
|
};
|
|
@@ -18911,7 +18846,7 @@
|
|
|
18911
18846
|
* @return {Mocha} this
|
|
18912
18847
|
* @chainable
|
|
18913
18848
|
*/
|
|
18914
|
-
Mocha.prototype.growl = function() {
|
|
18849
|
+
Mocha.prototype.growl = function () {
|
|
18915
18850
|
this.options.growl = this.isGrowlCapable();
|
|
18916
18851
|
if (!this.options.growl) {
|
|
18917
18852
|
var detail = utils.isBrowser()
|
|
@@ -18960,11 +18895,11 @@
|
|
|
18960
18895
|
* // Specify variables to be expected in global scope
|
|
18961
18896
|
* mocha.global(['jQuery', 'MyLib']);
|
|
18962
18897
|
*/
|
|
18963
|
-
Mocha.prototype.global = function(global) {
|
|
18898
|
+
Mocha.prototype.global = function (global) {
|
|
18964
18899
|
this.options.global = (this.options.global || [])
|
|
18965
18900
|
.concat(global)
|
|
18966
18901
|
.filter(Boolean)
|
|
18967
|
-
.filter(function(elt, idx, arr) {
|
|
18902
|
+
.filter(function (elt, idx, arr) {
|
|
18968
18903
|
return arr.indexOf(elt) === idx;
|
|
18969
18904
|
});
|
|
18970
18905
|
return this;
|
|
@@ -18981,7 +18916,7 @@
|
|
|
18981
18916
|
* @return {Mocha} this
|
|
18982
18917
|
* @chainable
|
|
18983
18918
|
*/
|
|
18984
|
-
Mocha.prototype.color = function(color) {
|
|
18919
|
+
Mocha.prototype.color = function (color) {
|
|
18985
18920
|
this.options.color = color !== false;
|
|
18986
18921
|
return this;
|
|
18987
18922
|
};
|
|
@@ -18996,7 +18931,7 @@
|
|
|
18996
18931
|
* @return {Mocha} this
|
|
18997
18932
|
* @chainable
|
|
18998
18933
|
*/
|
|
18999
|
-
Mocha.prototype.inlineDiffs = function(inlineDiffs) {
|
|
18934
|
+
Mocha.prototype.inlineDiffs = function (inlineDiffs) {
|
|
19000
18935
|
this.options.inlineDiffs = inlineDiffs !== false;
|
|
19001
18936
|
return this;
|
|
19002
18937
|
};
|
|
@@ -19010,7 +18945,7 @@
|
|
|
19010
18945
|
* @return {Mocha} this
|
|
19011
18946
|
* @chainable
|
|
19012
18947
|
*/
|
|
19013
|
-
Mocha.prototype.diff = function(diff) {
|
|
18948
|
+
Mocha.prototype.diff = function (diff) {
|
|
19014
18949
|
this.options.diff = diff !== false;
|
|
19015
18950
|
return this;
|
|
19016
18951
|
};
|
|
@@ -19038,7 +18973,7 @@
|
|
|
19038
18973
|
* // Same as above but using string argument
|
|
19039
18974
|
* mocha.timeout('1s');
|
|
19040
18975
|
*/
|
|
19041
|
-
Mocha.prototype.timeout = function(msecs) {
|
|
18976
|
+
Mocha.prototype.timeout = function (msecs) {
|
|
19042
18977
|
this.suite.timeout(msecs);
|
|
19043
18978
|
return this;
|
|
19044
18979
|
};
|
|
@@ -19057,7 +18992,7 @@
|
|
|
19057
18992
|
* // Allow any failed test to retry one more time
|
|
19058
18993
|
* mocha.retries(1);
|
|
19059
18994
|
*/
|
|
19060
|
-
Mocha.prototype.retries = function(retry) {
|
|
18995
|
+
Mocha.prototype.retries = function (retry) {
|
|
19061
18996
|
this.suite.retries(retry);
|
|
19062
18997
|
return this;
|
|
19063
18998
|
};
|
|
@@ -19079,7 +19014,7 @@
|
|
|
19079
19014
|
* // Same as above but using string argument
|
|
19080
19015
|
* mocha.slow('0.5s');
|
|
19081
19016
|
*/
|
|
19082
|
-
Mocha.prototype.slow = function(msecs) {
|
|
19017
|
+
Mocha.prototype.slow = function (msecs) {
|
|
19083
19018
|
this.suite.slow(msecs);
|
|
19084
19019
|
return this;
|
|
19085
19020
|
};
|
|
@@ -19093,7 +19028,7 @@
|
|
|
19093
19028
|
* @return {Mocha} this
|
|
19094
19029
|
* @chainable
|
|
19095
19030
|
*/
|
|
19096
|
-
Mocha.prototype.asyncOnly = function(asyncOnly) {
|
|
19031
|
+
Mocha.prototype.asyncOnly = function (asyncOnly) {
|
|
19097
19032
|
this.options.asyncOnly = asyncOnly !== false;
|
|
19098
19033
|
return this;
|
|
19099
19034
|
};
|
|
@@ -19105,7 +19040,7 @@
|
|
|
19105
19040
|
* @return {Mocha} this
|
|
19106
19041
|
* @chainable
|
|
19107
19042
|
*/
|
|
19108
|
-
Mocha.prototype.noHighlighting = function() {
|
|
19043
|
+
Mocha.prototype.noHighlighting = function () {
|
|
19109
19044
|
this.options.noHighlighting = true;
|
|
19110
19045
|
return this;
|
|
19111
19046
|
};
|
|
@@ -19119,7 +19054,7 @@
|
|
|
19119
19054
|
* @return {Mocha} this
|
|
19120
19055
|
* @chainable
|
|
19121
19056
|
*/
|
|
19122
|
-
Mocha.prototype.allowUncaught = function(allowUncaught) {
|
|
19057
|
+
Mocha.prototype.allowUncaught = function (allowUncaught) {
|
|
19123
19058
|
this.options.allowUncaught = allowUncaught !== false;
|
|
19124
19059
|
return this;
|
|
19125
19060
|
};
|
|
@@ -19150,7 +19085,7 @@
|
|
|
19150
19085
|
* @return {Mocha} this
|
|
19151
19086
|
* @chainable
|
|
19152
19087
|
*/
|
|
19153
|
-
Mocha.prototype.dryRun = function(dryRun) {
|
|
19088
|
+
Mocha.prototype.dryRun = function (dryRun) {
|
|
19154
19089
|
this.options.dryRun = dryRun !== false;
|
|
19155
19090
|
return this;
|
|
19156
19091
|
};
|
|
@@ -19164,7 +19099,7 @@
|
|
|
19164
19099
|
* @return {Mocha} this
|
|
19165
19100
|
* @chainable
|
|
19166
19101
|
*/
|
|
19167
|
-
Mocha.prototype.failZero = function(failZero) {
|
|
19102
|
+
Mocha.prototype.failZero = function (failZero) {
|
|
19168
19103
|
this.options.failZero = failZero !== false;
|
|
19169
19104
|
return this;
|
|
19170
19105
|
};
|
|
@@ -19178,7 +19113,7 @@
|
|
|
19178
19113
|
* @returns {Mocha} this
|
|
19179
19114
|
* @chainable
|
|
19180
19115
|
*/
|
|
19181
|
-
Mocha.prototype.forbidOnly = function(forbidOnly) {
|
|
19116
|
+
Mocha.prototype.forbidOnly = function (forbidOnly) {
|
|
19182
19117
|
this.options.forbidOnly = forbidOnly !== false;
|
|
19183
19118
|
return this;
|
|
19184
19119
|
};
|
|
@@ -19192,7 +19127,7 @@
|
|
|
19192
19127
|
* @returns {Mocha} this
|
|
19193
19128
|
* @chainable
|
|
19194
19129
|
*/
|
|
19195
|
-
Mocha.prototype.forbidPending = function(forbidPending) {
|
|
19130
|
+
Mocha.prototype.forbidPending = function (forbidPending) {
|
|
19196
19131
|
this.options.forbidPending = forbidPending !== false;
|
|
19197
19132
|
return this;
|
|
19198
19133
|
};
|
|
@@ -19201,7 +19136,7 @@
|
|
|
19201
19136
|
* Throws an error if mocha is in the wrong state to be able to transition to a "running" state.
|
|
19202
19137
|
* @private
|
|
19203
19138
|
*/
|
|
19204
|
-
Mocha.prototype._guardRunningStateTransition = function() {
|
|
19139
|
+
Mocha.prototype._guardRunningStateTransition = function () {
|
|
19205
19140
|
if (this._state === mochaStates.RUNNING) {
|
|
19206
19141
|
throw createMochaInstanceAlreadyRunningError(
|
|
19207
19142
|
'Mocha instance is currently running tests, cannot start a next test run until this one is done',
|
|
@@ -19228,7 +19163,7 @@
|
|
|
19228
19163
|
* @readonly
|
|
19229
19164
|
*/
|
|
19230
19165
|
Object.defineProperty(Mocha.prototype, 'version', {
|
|
19231
|
-
value: require$$
|
|
19166
|
+
value: require$$9.version,
|
|
19232
19167
|
configurable: false,
|
|
19233
19168
|
enumerable: true,
|
|
19234
19169
|
writable: false
|
|
@@ -19260,7 +19195,7 @@
|
|
|
19260
19195
|
* // exit with non-zero status if there were test failures
|
|
19261
19196
|
* mocha.run(failures => process.exitCode = failures ? 1 : 0);
|
|
19262
19197
|
*/
|
|
19263
|
-
Mocha.prototype.run = function(fn) {
|
|
19198
|
+
Mocha.prototype.run = function (fn) {
|
|
19264
19199
|
this._guardRunningStateTransition();
|
|
19265
19200
|
this._state = mochaStates.RUNNING;
|
|
19266
19201
|
if (this._previousRunner) {
|
|
@@ -19406,7 +19341,7 @@
|
|
|
19406
19341
|
|
|
19407
19342
|
// swap Runner class
|
|
19408
19343
|
this._runnerClass = parallel
|
|
19409
|
-
? require$$
|
|
19344
|
+
? require$$10
|
|
19410
19345
|
: exports.Runner;
|
|
19411
19346
|
|
|
19412
19347
|
// lazyLoadFiles may have been set `true` otherwise (for ESM loading),
|
|
@@ -19563,9 +19498,10 @@
|
|
|
19563
19498
|
* @public
|
|
19564
19499
|
* @returns {boolean}
|
|
19565
19500
|
*/
|
|
19566
|
-
Mocha.prototype.hasGlobalTeardownFixtures =
|
|
19567
|
-
|
|
19568
|
-
|
|
19501
|
+
Mocha.prototype.hasGlobalTeardownFixtures =
|
|
19502
|
+
function hasGlobalTeardownFixtures() {
|
|
19503
|
+
return Boolean(this.options.globalTeardown.length);
|
|
19504
|
+
};
|
|
19569
19505
|
|
|
19570
19506
|
/**
|
|
19571
19507
|
* An alternative way to define root hooks that works with parallel runs.
|
|
@@ -19657,12 +19593,12 @@
|
|
|
19657
19593
|
* Revert to original onerror handler if previously defined.
|
|
19658
19594
|
*/
|
|
19659
19595
|
|
|
19660
|
-
process$1.removeListener = function(e, fn) {
|
|
19596
|
+
process$1.removeListener = function (e, fn) {
|
|
19661
19597
|
if (e === 'uncaughtException') {
|
|
19662
19598
|
if (originalOnerrorHandler) {
|
|
19663
19599
|
commonjsGlobal.onerror = originalOnerrorHandler;
|
|
19664
19600
|
} else {
|
|
19665
|
-
commonjsGlobal.onerror = function() {};
|
|
19601
|
+
commonjsGlobal.onerror = function () {};
|
|
19666
19602
|
}
|
|
19667
19603
|
var i = uncaughtExceptionHandlers.indexOf(fn);
|
|
19668
19604
|
if (i !== -1) {
|
|
@@ -19675,7 +19611,7 @@
|
|
|
19675
19611
|
* Implements listenerCount for 'uncaughtException'.
|
|
19676
19612
|
*/
|
|
19677
19613
|
|
|
19678
|
-
process$1.listenerCount = function(name) {
|
|
19614
|
+
process$1.listenerCount = function (name) {
|
|
19679
19615
|
if (name === 'uncaughtException') {
|
|
19680
19616
|
return uncaughtExceptionHandlers.length;
|
|
19681
19617
|
}
|
|
@@ -19686,9 +19622,9 @@
|
|
|
19686
19622
|
* Implements uncaughtException listener.
|
|
19687
19623
|
*/
|
|
19688
19624
|
|
|
19689
|
-
process$1.on = function(e, fn) {
|
|
19625
|
+
process$1.on = function (e, fn) {
|
|
19690
19626
|
if (e === 'uncaughtException') {
|
|
19691
|
-
commonjsGlobal.onerror = function(err, url, line) {
|
|
19627
|
+
commonjsGlobal.onerror = function (err, url, line) {
|
|
19692
19628
|
fn(new Error(err + ' (' + url + ':' + line + ')'));
|
|
19693
19629
|
return !mocha.options.allowUncaught;
|
|
19694
19630
|
};
|
|
@@ -19696,7 +19632,7 @@
|
|
|
19696
19632
|
}
|
|
19697
19633
|
};
|
|
19698
19634
|
|
|
19699
|
-
process$1.listeners = function(e) {
|
|
19635
|
+
process$1.listeners = function (e) {
|
|
19700
19636
|
if (e === 'uncaughtException') {
|
|
19701
19637
|
return uncaughtExceptionHandlers;
|
|
19702
19638
|
}
|
|
@@ -19727,7 +19663,7 @@
|
|
|
19727
19663
|
* High-performance override of Runner.immediately.
|
|
19728
19664
|
*/
|
|
19729
19665
|
|
|
19730
|
-
mocha$1.Runner.immediately = function(callback) {
|
|
19666
|
+
mocha$1.Runner.immediately = function (callback) {
|
|
19731
19667
|
immediateQueue.push(callback);
|
|
19732
19668
|
if (!immediateTimeout) {
|
|
19733
19669
|
immediateTimeout = setTimeout$1(timeslice, 0);
|
|
@@ -19739,8 +19675,8 @@
|
|
|
19739
19675
|
* This is useful when running tests in a browser because window.onerror will
|
|
19740
19676
|
* only receive the 'message' attribute of the Error.
|
|
19741
19677
|
*/
|
|
19742
|
-
mocha.throwError = function(err) {
|
|
19743
|
-
uncaughtExceptionHandlers.forEach(function(fn) {
|
|
19678
|
+
mocha.throwError = function (err) {
|
|
19679
|
+
uncaughtExceptionHandlers.forEach(function (fn) {
|
|
19744
19680
|
fn(err);
|
|
19745
19681
|
});
|
|
19746
19682
|
throw err;
|
|
@@ -19751,7 +19687,7 @@
|
|
|
19751
19687
|
* Normally this would happen in Mocha.prototype.loadFiles.
|
|
19752
19688
|
*/
|
|
19753
19689
|
|
|
19754
|
-
mocha.ui = function(ui) {
|
|
19690
|
+
mocha.ui = function (ui) {
|
|
19755
19691
|
mocha$1.prototype.ui.call(this, ui);
|
|
19756
19692
|
this.suite.emit('pre-require', commonjsGlobal, null, this);
|
|
19757
19693
|
return this;
|
|
@@ -19761,7 +19697,7 @@
|
|
|
19761
19697
|
* Setup mocha with the given setting options.
|
|
19762
19698
|
*/
|
|
19763
19699
|
|
|
19764
|
-
mocha.setup = function(opts) {
|
|
19700
|
+
mocha.setup = function (opts) {
|
|
19765
19701
|
if (typeof opts === 'string') {
|
|
19766
19702
|
opts = {ui: opts};
|
|
19767
19703
|
}
|
|
@@ -19770,10 +19706,10 @@
|
|
|
19770
19706
|
}
|
|
19771
19707
|
var self = this;
|
|
19772
19708
|
Object.keys(opts)
|
|
19773
|
-
.filter(function(opt) {
|
|
19709
|
+
.filter(function (opt) {
|
|
19774
19710
|
return opt !== 'delay';
|
|
19775
19711
|
})
|
|
19776
|
-
.forEach(function(opt) {
|
|
19712
|
+
.forEach(function (opt) {
|
|
19777
19713
|
if (Object.prototype.hasOwnProperty.call(opts, opt)) {
|
|
19778
19714
|
self[opt](opts[opt]);
|
|
19779
19715
|
}
|
|
@@ -19785,7 +19721,7 @@
|
|
|
19785
19721
|
* Run mocha, returning the Runner.
|
|
19786
19722
|
*/
|
|
19787
19723
|
|
|
19788
|
-
mocha.run = function(fn) {
|
|
19724
|
+
mocha.run = function (fn) {
|
|
19789
19725
|
var options = mocha.options;
|
|
19790
19726
|
mocha.globals('location');
|
|
19791
19727
|
|
|
@@ -19800,7 +19736,7 @@
|
|
|
19800
19736
|
mocha.invert();
|
|
19801
19737
|
}
|
|
19802
19738
|
|
|
19803
|
-
return mocha$1.prototype.run.call(mocha, function(err) {
|
|
19739
|
+
return mocha$1.prototype.run.call(mocha, function (err) {
|
|
19804
19740
|
// The DOM Document is not available in Web Workers.
|
|
19805
19741
|
var document = commonjsGlobal.document;
|
|
19806
19742
|
if (
|
|
@@ -19826,15 +19762,22 @@
|
|
|
19826
19762
|
/**
|
|
19827
19763
|
* Expose mocha.
|
|
19828
19764
|
*/
|
|
19829
|
-
|
|
19830
19765
|
commonjsGlobal.Mocha = mocha$1;
|
|
19831
19766
|
commonjsGlobal.mocha = mocha;
|
|
19832
19767
|
|
|
19833
|
-
//
|
|
19834
|
-
//
|
|
19835
|
-
//
|
|
19836
|
-
|
|
19768
|
+
// for bundlers: enable `import {describe, it} from 'mocha'`
|
|
19769
|
+
// `bdd` interface only
|
|
19770
|
+
// prettier-ignore
|
|
19771
|
+
[
|
|
19772
|
+
'describe', 'context', 'it', 'specify',
|
|
19773
|
+
'xdescribe', 'xcontext', 'xit', 'xspecify',
|
|
19774
|
+
'before', 'beforeEach', 'afterEach', 'after'
|
|
19775
|
+
].forEach(function(key) {
|
|
19776
|
+
mocha[key] = commonjsGlobal[key];
|
|
19777
|
+
});
|
|
19778
|
+
|
|
19779
|
+
var browserEntry = mocha;
|
|
19837
19780
|
|
|
19838
19781
|
return browserEntry;
|
|
19839
19782
|
|
|
19840
|
-
}))
|
|
19783
|
+
}));
|