mocha 9.1.3 → 9.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/browser-entry.js +15 -15
- 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/run.js +1 -1
- package/lib/cli/watch-run.js +1 -4
- 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 +56 -58
- package/lib/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 +29 -29
- package/lib/test.js +4 -4
- package/lib/utils.js +18 -19
- package/mocha-es2018.js +380 -386
- package/mocha.js +752 -551
- package/mocha.js.map +1 -1
- package/package.json +16 -15
- package/CHANGELOG.md +0 -1025
package/mocha-es2018.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// mocha@9.1.
|
|
1
|
+
// mocha@9.1.4 in javascript ES2018
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -7383,7 +7383,7 @@
|
|
|
7383
7383
|
return qs
|
|
7384
7384
|
.replace('?', '')
|
|
7385
7385
|
.split('&')
|
|
7386
|
-
.reduce(function(obj, pair) {
|
|
7386
|
+
.reduce(function (obj, pair) {
|
|
7387
7387
|
var i = pair.indexOf('=');
|
|
7388
7388
|
var key = pair.slice(0, i);
|
|
7389
7389
|
var val = pair.slice(++i);
|
|
@@ -9835,7 +9835,7 @@
|
|
|
9835
9835
|
* @param {string} html
|
|
9836
9836
|
* @return {string}
|
|
9837
9837
|
*/
|
|
9838
|
-
exports.escape = function(html) {
|
|
9838
|
+
exports.escape = function (html) {
|
|
9839
9839
|
return he.encode(String(html), {useNamedReferences: false});
|
|
9840
9840
|
};
|
|
9841
9841
|
|
|
@@ -9846,7 +9846,7 @@
|
|
|
9846
9846
|
* @param {Object} obj
|
|
9847
9847
|
* @return {boolean}
|
|
9848
9848
|
*/
|
|
9849
|
-
exports.isString = function(obj) {
|
|
9849
|
+
exports.isString = function (obj) {
|
|
9850
9850
|
return typeof obj === 'string';
|
|
9851
9851
|
};
|
|
9852
9852
|
|
|
@@ -9857,7 +9857,7 @@
|
|
|
9857
9857
|
* @param {string} str
|
|
9858
9858
|
* @return {string}
|
|
9859
9859
|
*/
|
|
9860
|
-
exports.slug = function(str) {
|
|
9860
|
+
exports.slug = function (str) {
|
|
9861
9861
|
return str
|
|
9862
9862
|
.toLowerCase()
|
|
9863
9863
|
.replace(/\s+/g, '-')
|
|
@@ -9871,7 +9871,7 @@
|
|
|
9871
9871
|
* @param {string} str
|
|
9872
9872
|
* @return {string}
|
|
9873
9873
|
*/
|
|
9874
|
-
exports.clean = function(str) {
|
|
9874
|
+
exports.clean = function (str) {
|
|
9875
9875
|
str = str
|
|
9876
9876
|
.replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
|
|
9877
9877
|
.replace(/^\uFEFF/, '')
|
|
@@ -10013,7 +10013,7 @@
|
|
|
10013
10013
|
* @param {*} value
|
|
10014
10014
|
* @return {string}
|
|
10015
10015
|
*/
|
|
10016
|
-
exports.stringify = function(value) {
|
|
10016
|
+
exports.stringify = function (value) {
|
|
10017
10017
|
var typeHint = canonicalType(value);
|
|
10018
10018
|
|
|
10019
10019
|
if (!~['object', 'array', 'function'].indexOf(typeHint)) {
|
|
@@ -10029,7 +10029,7 @@
|
|
|
10029
10029
|
// IE7/IE8 has a bizarre String constructor; needs to be coerced
|
|
10030
10030
|
// into an array and back to obj.
|
|
10031
10031
|
if (typeHint === 'string' && typeof value === 'object') {
|
|
10032
|
-
value = value.split('').reduce(function(acc, char, idx) {
|
|
10032
|
+
value = value.split('').reduce(function (acc, char, idx) {
|
|
10033
10033
|
acc[idx] = char;
|
|
10034
10034
|
return acc;
|
|
10035
10035
|
}, {});
|
|
@@ -10184,8 +10184,8 @@
|
|
|
10184
10184
|
canonicalizedObj = value;
|
|
10185
10185
|
break;
|
|
10186
10186
|
case 'array':
|
|
10187
|
-
withStack(value, function() {
|
|
10188
|
-
canonicalizedObj = value.map(function(item) {
|
|
10187
|
+
withStack(value, function () {
|
|
10188
|
+
canonicalizedObj = value.map(function (item) {
|
|
10189
10189
|
return exports.canonicalize(item, stack);
|
|
10190
10190
|
});
|
|
10191
10191
|
});
|
|
@@ -10204,10 +10204,10 @@
|
|
|
10204
10204
|
/* falls through */
|
|
10205
10205
|
case 'object':
|
|
10206
10206
|
canonicalizedObj = canonicalizedObj || {};
|
|
10207
|
-
withStack(value, function() {
|
|
10207
|
+
withStack(value, function () {
|
|
10208
10208
|
Object.keys(value)
|
|
10209
10209
|
.sort()
|
|
10210
|
-
.forEach(function(key) {
|
|
10210
|
+
.forEach(function (key) {
|
|
10211
10211
|
canonicalizedObj[key] = exports.canonicalize(value[key], stack);
|
|
10212
10212
|
});
|
|
10213
10213
|
});
|
|
@@ -10235,7 +10235,7 @@
|
|
|
10235
10235
|
* (i.e: strip Mocha and internal node functions from stack trace).
|
|
10236
10236
|
* @returns {Function}
|
|
10237
10237
|
*/
|
|
10238
|
-
exports.stackTraceFilter = function() {
|
|
10238
|
+
exports.stackTraceFilter = function () {
|
|
10239
10239
|
// TODO: Replace with `process.browser`
|
|
10240
10240
|
var is = typeof document === 'undefined' ? {node: true} : {browser: true};
|
|
10241
10241
|
var slash = path.sep;
|
|
@@ -10243,9 +10243,8 @@
|
|
|
10243
10243
|
if (is.node) {
|
|
10244
10244
|
cwd = exports.cwd() + slash;
|
|
10245
10245
|
} else {
|
|
10246
|
-
cwd = (
|
|
10247
|
-
? window.location
|
|
10248
|
-
: location
|
|
10246
|
+
cwd = (
|
|
10247
|
+
typeof location === 'undefined' ? window.location : location
|
|
10249
10248
|
).href.replace(/\/[^/]*$/, '/');
|
|
10250
10249
|
slash = '/';
|
|
10251
10250
|
}
|
|
@@ -10269,10 +10268,10 @@
|
|
|
10269
10268
|
);
|
|
10270
10269
|
}
|
|
10271
10270
|
|
|
10272
|
-
return function(stack) {
|
|
10271
|
+
return function (stack) {
|
|
10273
10272
|
stack = stack.split('\n');
|
|
10274
10273
|
|
|
10275
|
-
stack = stack.reduce(function(list, line) {
|
|
10274
|
+
stack = stack.reduce(function (list, line) {
|
|
10276
10275
|
if (isMochaInternal(line)) {
|
|
10277
10276
|
return list;
|
|
10278
10277
|
}
|
|
@@ -10323,7 +10322,7 @@
|
|
|
10323
10322
|
* It's a noop.
|
|
10324
10323
|
* @public
|
|
10325
10324
|
*/
|
|
10326
|
-
exports.noop = function() {};
|
|
10325
|
+
exports.noop = function () {};
|
|
10327
10326
|
|
|
10328
10327
|
/**
|
|
10329
10328
|
* Creates a map-like object.
|
|
@@ -10340,7 +10339,7 @@
|
|
|
10340
10339
|
* @param {...*} [obj] - Arguments to `Object.assign()`.
|
|
10341
10340
|
* @returns {Object} An object with no prototype, having `...obj` properties
|
|
10342
10341
|
*/
|
|
10343
|
-
exports.createMap = function(obj) {
|
|
10342
|
+
exports.createMap = function (obj) {
|
|
10344
10343
|
return Object.assign.apply(
|
|
10345
10344
|
null,
|
|
10346
10345
|
[Object.create(null)].concat(Array.prototype.slice.call(arguments))
|
|
@@ -10359,7 +10358,7 @@
|
|
|
10359
10358
|
* @returns {Object} A frozen object with no prototype, having `...obj` properties
|
|
10360
10359
|
* @throws {TypeError} if argument is not a non-empty object.
|
|
10361
10360
|
*/
|
|
10362
|
-
exports.defineConstants = function(obj) {
|
|
10361
|
+
exports.defineConstants = function (obj) {
|
|
10363
10362
|
if (canonicalType(obj) !== 'object' || !Object.keys(obj).length) {
|
|
10364
10363
|
throw new TypeError('Invalid argument; expected a non-empty object');
|
|
10365
10364
|
}
|
|
@@ -11198,7 +11197,7 @@
|
|
|
11198
11197
|
process$1.emitWarning(msg, type);
|
|
11199
11198
|
} else {
|
|
11200
11199
|
/* istanbul ignore next */
|
|
11201
|
-
nextTick$1(function() {
|
|
11200
|
+
nextTick$1(function () {
|
|
11202
11201
|
console.warn(type + ': ' + msg);
|
|
11203
11202
|
});
|
|
11204
11203
|
}
|
|
@@ -11790,7 +11789,7 @@
|
|
|
11790
11789
|
/**
|
|
11791
11790
|
* Resets the state initially or for a next run.
|
|
11792
11791
|
*/
|
|
11793
|
-
Runnable.prototype.reset = function() {
|
|
11792
|
+
Runnable.prototype.reset = function () {
|
|
11794
11793
|
this.timedOut = false;
|
|
11795
11794
|
this._currentRetry = 0;
|
|
11796
11795
|
this.pending = false;
|
|
@@ -11819,7 +11818,7 @@
|
|
|
11819
11818
|
* @returns {Runnable} this
|
|
11820
11819
|
* @chainable
|
|
11821
11820
|
*/
|
|
11822
|
-
Runnable.prototype.timeout = function(ms) {
|
|
11821
|
+
Runnable.prototype.timeout = function (ms) {
|
|
11823
11822
|
if (!arguments.length) {
|
|
11824
11823
|
return this._timeout;
|
|
11825
11824
|
}
|
|
@@ -11853,7 +11852,7 @@
|
|
|
11853
11852
|
* @param {number|string} ms
|
|
11854
11853
|
* @return {Runnable|number} ms or Runnable instance.
|
|
11855
11854
|
*/
|
|
11856
|
-
Runnable.prototype.slow = function(ms) {
|
|
11855
|
+
Runnable.prototype.slow = function (ms) {
|
|
11857
11856
|
if (!arguments.length || typeof ms === 'undefined') {
|
|
11858
11857
|
return this._slow;
|
|
11859
11858
|
}
|
|
@@ -11871,7 +11870,7 @@
|
|
|
11871
11870
|
* @memberof Mocha.Runnable
|
|
11872
11871
|
* @public
|
|
11873
11872
|
*/
|
|
11874
|
-
Runnable.prototype.skip = function() {
|
|
11873
|
+
Runnable.prototype.skip = function () {
|
|
11875
11874
|
this.pending = true;
|
|
11876
11875
|
throw new pending('sync skip; aborting execution');
|
|
11877
11876
|
};
|
|
@@ -11881,7 +11880,7 @@
|
|
|
11881
11880
|
*
|
|
11882
11881
|
* @private
|
|
11883
11882
|
*/
|
|
11884
|
-
Runnable.prototype.isPending = function() {
|
|
11883
|
+
Runnable.prototype.isPending = function () {
|
|
11885
11884
|
return this.pending || (this.parent && this.parent.isPending());
|
|
11886
11885
|
};
|
|
11887
11886
|
|
|
@@ -11890,7 +11889,7 @@
|
|
|
11890
11889
|
* @return {boolean}
|
|
11891
11890
|
* @private
|
|
11892
11891
|
*/
|
|
11893
|
-
Runnable.prototype.isFailed = function() {
|
|
11892
|
+
Runnable.prototype.isFailed = function () {
|
|
11894
11893
|
return !this.isPending() && this.state === constants$3.STATE_FAILED;
|
|
11895
11894
|
};
|
|
11896
11895
|
|
|
@@ -11899,7 +11898,7 @@
|
|
|
11899
11898
|
* @return {boolean}
|
|
11900
11899
|
* @private
|
|
11901
11900
|
*/
|
|
11902
|
-
Runnable.prototype.isPassed = function() {
|
|
11901
|
+
Runnable.prototype.isPassed = function () {
|
|
11903
11902
|
return !this.isPending() && this.state === constants$3.STATE_PASSED;
|
|
11904
11903
|
};
|
|
11905
11904
|
|
|
@@ -11908,7 +11907,7 @@
|
|
|
11908
11907
|
*
|
|
11909
11908
|
* @private
|
|
11910
11909
|
*/
|
|
11911
|
-
Runnable.prototype.retries = function(n) {
|
|
11910
|
+
Runnable.prototype.retries = function (n) {
|
|
11912
11911
|
if (!arguments.length) {
|
|
11913
11912
|
return this._retries;
|
|
11914
11913
|
}
|
|
@@ -11920,7 +11919,7 @@
|
|
|
11920
11919
|
*
|
|
11921
11920
|
* @private
|
|
11922
11921
|
*/
|
|
11923
|
-
Runnable.prototype.currentRetry = function(n) {
|
|
11922
|
+
Runnable.prototype.currentRetry = function (n) {
|
|
11924
11923
|
if (!arguments.length) {
|
|
11925
11924
|
return this._currentRetry;
|
|
11926
11925
|
}
|
|
@@ -11935,7 +11934,7 @@
|
|
|
11935
11934
|
* @public
|
|
11936
11935
|
* @return {string}
|
|
11937
11936
|
*/
|
|
11938
|
-
Runnable.prototype.fullTitle = function() {
|
|
11937
|
+
Runnable.prototype.fullTitle = function () {
|
|
11939
11938
|
return this.titlePath().join(' ');
|
|
11940
11939
|
};
|
|
11941
11940
|
|
|
@@ -11946,7 +11945,7 @@
|
|
|
11946
11945
|
* @public
|
|
11947
11946
|
* @return {string}
|
|
11948
11947
|
*/
|
|
11949
|
-
Runnable.prototype.titlePath = function() {
|
|
11948
|
+
Runnable.prototype.titlePath = function () {
|
|
11950
11949
|
return this.parent.titlePath().concat([this.title]);
|
|
11951
11950
|
};
|
|
11952
11951
|
|
|
@@ -11955,7 +11954,7 @@
|
|
|
11955
11954
|
*
|
|
11956
11955
|
* @private
|
|
11957
11956
|
*/
|
|
11958
|
-
Runnable.prototype.clearTimeout = function() {
|
|
11957
|
+
Runnable.prototype.clearTimeout = function () {
|
|
11959
11958
|
clearTimeout$1(this.timer);
|
|
11960
11959
|
};
|
|
11961
11960
|
|
|
@@ -11964,7 +11963,7 @@
|
|
|
11964
11963
|
*
|
|
11965
11964
|
* @private
|
|
11966
11965
|
*/
|
|
11967
|
-
Runnable.prototype.resetTimeout = function() {
|
|
11966
|
+
Runnable.prototype.resetTimeout = function () {
|
|
11968
11967
|
var self = this;
|
|
11969
11968
|
var ms = this.timeout();
|
|
11970
11969
|
|
|
@@ -11972,7 +11971,7 @@
|
|
|
11972
11971
|
return;
|
|
11973
11972
|
}
|
|
11974
11973
|
this.clearTimeout();
|
|
11975
|
-
this.timer = setTimeout$3(function() {
|
|
11974
|
+
this.timer = setTimeout$3(function () {
|
|
11976
11975
|
if (self.timeout() === 0) {
|
|
11977
11976
|
return;
|
|
11978
11977
|
}
|
|
@@ -11987,7 +11986,7 @@
|
|
|
11987
11986
|
* @private
|
|
11988
11987
|
* @param {string[]} globals
|
|
11989
11988
|
*/
|
|
11990
|
-
Runnable.prototype.globals = function(globals) {
|
|
11989
|
+
Runnable.prototype.globals = function (globals) {
|
|
11991
11990
|
if (!arguments.length) {
|
|
11992
11991
|
return this._allowedGlobals;
|
|
11993
11992
|
}
|
|
@@ -12000,7 +11999,7 @@
|
|
|
12000
11999
|
* @param {Function} fn
|
|
12001
12000
|
* @private
|
|
12002
12001
|
*/
|
|
12003
|
-
Runnable.prototype.run = function(fn) {
|
|
12002
|
+
Runnable.prototype.run = function (fn) {
|
|
12004
12003
|
var self = this;
|
|
12005
12004
|
var start = new Date$4();
|
|
12006
12005
|
var ctx = this.ctx;
|
|
@@ -12100,13 +12099,13 @@
|
|
|
12100
12099
|
if (result && typeof result.then === 'function') {
|
|
12101
12100
|
self.resetTimeout();
|
|
12102
12101
|
result.then(
|
|
12103
|
-
function() {
|
|
12102
|
+
function () {
|
|
12104
12103
|
done();
|
|
12105
12104
|
// Return null so libraries like bluebird do not warn about
|
|
12106
12105
|
// subsequently constructed Promises.
|
|
12107
12106
|
return null;
|
|
12108
12107
|
},
|
|
12109
|
-
function(reason) {
|
|
12108
|
+
function (reason) {
|
|
12110
12109
|
done(reason || new Error('Promise rejected with no or falsy reason'));
|
|
12111
12110
|
}
|
|
12112
12111
|
);
|
|
@@ -12124,7 +12123,7 @@
|
|
|
12124
12123
|
}
|
|
12125
12124
|
|
|
12126
12125
|
function callFnAsync(fn) {
|
|
12127
|
-
var result = fn.call(ctx, function(err) {
|
|
12126
|
+
var result = fn.call(ctx, function (err) {
|
|
12128
12127
|
if (err instanceof Error || toString.call(err) === '[object Error]') {
|
|
12129
12128
|
return done(err);
|
|
12130
12129
|
}
|
|
@@ -12156,7 +12155,7 @@
|
|
|
12156
12155
|
* @returns {Error} a "timeout" error
|
|
12157
12156
|
* @private
|
|
12158
12157
|
*/
|
|
12159
|
-
Runnable.prototype._timeoutError = function(ms) {
|
|
12158
|
+
Runnable.prototype._timeoutError = function (ms) {
|
|
12160
12159
|
let msg = `Timeout of ${ms}ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.`;
|
|
12161
12160
|
if (this.file) {
|
|
12162
12161
|
msg += ' (' + this.file + ')';
|
|
@@ -12196,7 +12195,7 @@
|
|
|
12196
12195
|
* @returns {*|Error} `value`, otherwise an `Error`
|
|
12197
12196
|
* @private
|
|
12198
12197
|
*/
|
|
12199
|
-
Runnable.toValueOrError = function(value) {
|
|
12198
|
+
Runnable.toValueOrError = function (value) {
|
|
12200
12199
|
return (
|
|
12201
12200
|
value ||
|
|
12202
12201
|
createInvalidExceptionError$1(
|
|
@@ -12238,7 +12237,7 @@
|
|
|
12238
12237
|
/**
|
|
12239
12238
|
* Resets the state for a next run.
|
|
12240
12239
|
*/
|
|
12241
|
-
Hook.prototype.reset = function() {
|
|
12240
|
+
Hook.prototype.reset = function () {
|
|
12242
12241
|
runnable.prototype.reset.call(this);
|
|
12243
12242
|
delete this._error;
|
|
12244
12243
|
};
|
|
@@ -12251,7 +12250,7 @@
|
|
|
12251
12250
|
* @param {Error} err
|
|
12252
12251
|
* @return {Error}
|
|
12253
12252
|
*/
|
|
12254
|
-
Hook.prototype.error = function(err) {
|
|
12253
|
+
Hook.prototype.error = function (err) {
|
|
12255
12254
|
if (!arguments.length) {
|
|
12256
12255
|
err = this._error;
|
|
12257
12256
|
this._error = null;
|
|
@@ -12332,7 +12331,7 @@
|
|
|
12332
12331
|
* @param {string} title - Title
|
|
12333
12332
|
* @return {Suite}
|
|
12334
12333
|
*/
|
|
12335
|
-
Suite.create = function(parent, title) {
|
|
12334
|
+
Suite.create = function (parent, title) {
|
|
12336
12335
|
var suite = new Suite(title, parent.ctx);
|
|
12337
12336
|
suite.parent = parent;
|
|
12338
12337
|
title = suite.fullTitle();
|
|
@@ -12398,7 +12397,7 @@
|
|
|
12398
12397
|
/**
|
|
12399
12398
|
* Resets the state initially or for a next run.
|
|
12400
12399
|
*/
|
|
12401
|
-
Suite.prototype.reset = function() {
|
|
12400
|
+
Suite.prototype.reset = function () {
|
|
12402
12401
|
this.delayed = false;
|
|
12403
12402
|
function doReset(thingToReset) {
|
|
12404
12403
|
thingToReset.reset();
|
|
@@ -12417,7 +12416,7 @@
|
|
|
12417
12416
|
* @private
|
|
12418
12417
|
* @return {Suite}
|
|
12419
12418
|
*/
|
|
12420
|
-
Suite.prototype.clone = function() {
|
|
12419
|
+
Suite.prototype.clone = function () {
|
|
12421
12420
|
var suite = new Suite(this.title);
|
|
12422
12421
|
debug('clone');
|
|
12423
12422
|
suite.ctx = this.ctx;
|
|
@@ -12437,7 +12436,7 @@
|
|
|
12437
12436
|
* @param {number|string} ms
|
|
12438
12437
|
* @return {Suite|number} for chaining
|
|
12439
12438
|
*/
|
|
12440
|
-
Suite.prototype.timeout = function(ms) {
|
|
12439
|
+
Suite.prototype.timeout = function (ms) {
|
|
12441
12440
|
if (!arguments.length) {
|
|
12442
12441
|
return this._timeout;
|
|
12443
12442
|
}
|
|
@@ -12462,7 +12461,7 @@
|
|
|
12462
12461
|
* @param {number|string} n
|
|
12463
12462
|
* @return {Suite|number} for chaining
|
|
12464
12463
|
*/
|
|
12465
|
-
Suite.prototype.retries = function(n) {
|
|
12464
|
+
Suite.prototype.retries = function (n) {
|
|
12466
12465
|
if (!arguments.length) {
|
|
12467
12466
|
return this._retries;
|
|
12468
12467
|
}
|
|
@@ -12478,7 +12477,7 @@
|
|
|
12478
12477
|
* @param {number|string} ms
|
|
12479
12478
|
* @return {Suite|number} for chaining
|
|
12480
12479
|
*/
|
|
12481
|
-
Suite.prototype.slow = function(ms) {
|
|
12480
|
+
Suite.prototype.slow = function (ms) {
|
|
12482
12481
|
if (!arguments.length) {
|
|
12483
12482
|
return this._slow;
|
|
12484
12483
|
}
|
|
@@ -12497,7 +12496,7 @@
|
|
|
12497
12496
|
* @param {boolean} bail
|
|
12498
12497
|
* @return {Suite|number} for chaining
|
|
12499
12498
|
*/
|
|
12500
|
-
Suite.prototype.bail = function(bail) {
|
|
12499
|
+
Suite.prototype.bail = function (bail) {
|
|
12501
12500
|
if (!arguments.length) {
|
|
12502
12501
|
return this._bail;
|
|
12503
12502
|
}
|
|
@@ -12511,7 +12510,7 @@
|
|
|
12511
12510
|
*
|
|
12512
12511
|
* @private
|
|
12513
12512
|
*/
|
|
12514
|
-
Suite.prototype.isPending = function() {
|
|
12513
|
+
Suite.prototype.isPending = function () {
|
|
12515
12514
|
return this.pending || (this.parent && this.parent.isPending());
|
|
12516
12515
|
};
|
|
12517
12516
|
|
|
@@ -12522,7 +12521,7 @@
|
|
|
12522
12521
|
* @param {Function} fn - Hook callback
|
|
12523
12522
|
* @returns {Hook} A new hook
|
|
12524
12523
|
*/
|
|
12525
|
-
Suite.prototype._createHook = function(title, fn) {
|
|
12524
|
+
Suite.prototype._createHook = function (title, fn) {
|
|
12526
12525
|
var hook$1 = new hook(title, fn);
|
|
12527
12526
|
hook$1.parent = this;
|
|
12528
12527
|
hook$1.timeout(this.timeout());
|
|
@@ -12541,7 +12540,7 @@
|
|
|
12541
12540
|
* @param {Function} fn
|
|
12542
12541
|
* @return {Suite} for chaining
|
|
12543
12542
|
*/
|
|
12544
|
-
Suite.prototype.beforeAll = function(title, fn) {
|
|
12543
|
+
Suite.prototype.beforeAll = function (title, fn) {
|
|
12545
12544
|
if (this.isPending()) {
|
|
12546
12545
|
return this;
|
|
12547
12546
|
}
|
|
@@ -12565,7 +12564,7 @@
|
|
|
12565
12564
|
* @param {Function} fn
|
|
12566
12565
|
* @return {Suite} for chaining
|
|
12567
12566
|
*/
|
|
12568
|
-
Suite.prototype.afterAll = function(title, fn) {
|
|
12567
|
+
Suite.prototype.afterAll = function (title, fn) {
|
|
12569
12568
|
if (this.isPending()) {
|
|
12570
12569
|
return this;
|
|
12571
12570
|
}
|
|
@@ -12589,7 +12588,7 @@
|
|
|
12589
12588
|
* @param {Function} fn
|
|
12590
12589
|
* @return {Suite} for chaining
|
|
12591
12590
|
*/
|
|
12592
|
-
Suite.prototype.beforeEach = function(title, fn) {
|
|
12591
|
+
Suite.prototype.beforeEach = function (title, fn) {
|
|
12593
12592
|
if (this.isPending()) {
|
|
12594
12593
|
return this;
|
|
12595
12594
|
}
|
|
@@ -12613,7 +12612,7 @@
|
|
|
12613
12612
|
* @param {Function} fn
|
|
12614
12613
|
* @return {Suite} for chaining
|
|
12615
12614
|
*/
|
|
12616
|
-
Suite.prototype.afterEach = function(title, fn) {
|
|
12615
|
+
Suite.prototype.afterEach = function (title, fn) {
|
|
12617
12616
|
if (this.isPending()) {
|
|
12618
12617
|
return this;
|
|
12619
12618
|
}
|
|
@@ -12636,7 +12635,7 @@
|
|
|
12636
12635
|
* @param {Suite} suite
|
|
12637
12636
|
* @return {Suite} for chaining
|
|
12638
12637
|
*/
|
|
12639
|
-
Suite.prototype.addSuite = function(suite) {
|
|
12638
|
+
Suite.prototype.addSuite = function (suite) {
|
|
12640
12639
|
suite.parent = this;
|
|
12641
12640
|
suite.root = false;
|
|
12642
12641
|
suite.timeout(this.timeout());
|
|
@@ -12655,7 +12654,7 @@
|
|
|
12655
12654
|
* @param {Test} test
|
|
12656
12655
|
* @return {Suite} for chaining
|
|
12657
12656
|
*/
|
|
12658
|
-
Suite.prototype.addTest = function(test) {
|
|
12657
|
+
Suite.prototype.addTest = function (test) {
|
|
12659
12658
|
test.parent = this;
|
|
12660
12659
|
test.timeout(this.timeout());
|
|
12661
12660
|
test.retries(this.retries());
|
|
@@ -12674,7 +12673,7 @@
|
|
|
12674
12673
|
* @public
|
|
12675
12674
|
* @return {string}
|
|
12676
12675
|
*/
|
|
12677
|
-
Suite.prototype.fullTitle = function() {
|
|
12676
|
+
Suite.prototype.fullTitle = function () {
|
|
12678
12677
|
return this.titlePath().join(' ');
|
|
12679
12678
|
};
|
|
12680
12679
|
|
|
@@ -12686,7 +12685,7 @@
|
|
|
12686
12685
|
* @public
|
|
12687
12686
|
* @return {string}
|
|
12688
12687
|
*/
|
|
12689
|
-
Suite.prototype.titlePath = function() {
|
|
12688
|
+
Suite.prototype.titlePath = function () {
|
|
12690
12689
|
var result = [];
|
|
12691
12690
|
if (this.parent) {
|
|
12692
12691
|
result = result.concat(this.parent.titlePath());
|
|
@@ -12704,9 +12703,9 @@
|
|
|
12704
12703
|
* @public
|
|
12705
12704
|
* @return {number}
|
|
12706
12705
|
*/
|
|
12707
|
-
Suite.prototype.total = function() {
|
|
12706
|
+
Suite.prototype.total = function () {
|
|
12708
12707
|
return (
|
|
12709
|
-
this.suites.reduce(function(sum, suite) {
|
|
12708
|
+
this.suites.reduce(function (sum, suite) {
|
|
12710
12709
|
return sum + suite.total();
|
|
12711
12710
|
}, 0) + this.tests.length
|
|
12712
12711
|
);
|
|
@@ -12720,9 +12719,9 @@
|
|
|
12720
12719
|
* @param {Function} fn
|
|
12721
12720
|
* @return {Suite}
|
|
12722
12721
|
*/
|
|
12723
|
-
Suite.prototype.eachTest = function(fn) {
|
|
12722
|
+
Suite.prototype.eachTest = function (fn) {
|
|
12724
12723
|
this.tests.forEach(fn);
|
|
12725
|
-
this.suites.forEach(function(suite) {
|
|
12724
|
+
this.suites.forEach(function (suite) {
|
|
12726
12725
|
suite.eachTest(fn);
|
|
12727
12726
|
});
|
|
12728
12727
|
return this;
|
|
@@ -12748,7 +12747,7 @@
|
|
|
12748
12747
|
return (
|
|
12749
12748
|
this._onlyTests.length > 0 ||
|
|
12750
12749
|
this._onlySuites.length > 0 ||
|
|
12751
|
-
this.suites.some(function(suite) {
|
|
12750
|
+
this.suites.some(function (suite) {
|
|
12752
12751
|
return suite.hasOnly();
|
|
12753
12752
|
})
|
|
12754
12753
|
);
|
|
@@ -12768,7 +12767,7 @@
|
|
|
12768
12767
|
} else {
|
|
12769
12768
|
// Otherwise, do not run any of the tests in this suite.
|
|
12770
12769
|
this.tests = [];
|
|
12771
|
-
this._onlySuites.forEach(function(onlySuite) {
|
|
12770
|
+
this._onlySuites.forEach(function (onlySuite) {
|
|
12772
12771
|
// If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
|
|
12773
12772
|
// Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
|
|
12774
12773
|
if (onlySuite.hasOnly()) {
|
|
@@ -12777,7 +12776,7 @@
|
|
|
12777
12776
|
});
|
|
12778
12777
|
// Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
|
|
12779
12778
|
var onlySuites = this._onlySuites;
|
|
12780
|
-
this.suites = this.suites.filter(function(childSuite) {
|
|
12779
|
+
this.suites = this.suites.filter(function (childSuite) {
|
|
12781
12780
|
return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
|
|
12782
12781
|
});
|
|
12783
12782
|
}
|
|
@@ -12791,7 +12790,7 @@
|
|
|
12791
12790
|
* @private
|
|
12792
12791
|
* @param {Suite} suite
|
|
12793
12792
|
*/
|
|
12794
|
-
Suite.prototype.appendOnlySuite = function(suite) {
|
|
12793
|
+
Suite.prototype.appendOnlySuite = function (suite) {
|
|
12795
12794
|
this._onlySuites.push(suite);
|
|
12796
12795
|
};
|
|
12797
12796
|
|
|
@@ -12800,7 +12799,7 @@
|
|
|
12800
12799
|
*
|
|
12801
12800
|
* @private
|
|
12802
12801
|
*/
|
|
12803
|
-
Suite.prototype.markOnly = function() {
|
|
12802
|
+
Suite.prototype.markOnly = function () {
|
|
12804
12803
|
this.parent && this.parent.appendOnlySuite(this);
|
|
12805
12804
|
};
|
|
12806
12805
|
|
|
@@ -12810,7 +12809,7 @@
|
|
|
12810
12809
|
* @private
|
|
12811
12810
|
* @param {Test} test
|
|
12812
12811
|
*/
|
|
12813
|
-
Suite.prototype.appendOnlyTest = function(test) {
|
|
12812
|
+
Suite.prototype.appendOnlyTest = function (test) {
|
|
12814
12813
|
this._onlyTests.push(test);
|
|
12815
12814
|
};
|
|
12816
12815
|
|
|
@@ -12825,8 +12824,8 @@
|
|
|
12825
12824
|
/**
|
|
12826
12825
|
* cleans all references from this suite and all child suites.
|
|
12827
12826
|
*/
|
|
12828
|
-
Suite.prototype.dispose = function() {
|
|
12829
|
-
this.suites.forEach(function(suite) {
|
|
12827
|
+
Suite.prototype.dispose = function () {
|
|
12828
|
+
this.suites.forEach(function (suite) {
|
|
12830
12829
|
suite.dispose();
|
|
12831
12830
|
});
|
|
12832
12831
|
this.cleanReferences();
|
|
@@ -13102,7 +13101,7 @@
|
|
|
13102
13101
|
* @param {boolean} [opts.cleanReferencesAfterRun] - Whether to clean references to test fns and hooks when a suite is done.
|
|
13103
13102
|
* @param {boolean} [opts.delay] - Whether to delay execution of root suite until ready.
|
|
13104
13103
|
* @param {boolean} [opts.dryRun] - Whether to report tests without running them.
|
|
13105
|
-
* @param {boolean} [
|
|
13104
|
+
* @param {boolean} [opts.failZero] - Whether to fail test run if zero tests encountered.
|
|
13106
13105
|
*/
|
|
13107
13106
|
constructor(suite, opts) {
|
|
13108
13107
|
super();
|
|
@@ -13131,7 +13130,7 @@
|
|
|
13131
13130
|
* @type {Map<EventEmitter,Map<string,Set<EventListener>>>}
|
|
13132
13131
|
*/
|
|
13133
13132
|
this._eventListeners = new Map();
|
|
13134
|
-
this.on(constants$1.EVENT_TEST_END, function(test) {
|
|
13133
|
+
this.on(constants$1.EVENT_TEST_END, function (test) {
|
|
13135
13134
|
if (test.type === 'test' && test.retriedTest() && test.parent) {
|
|
13136
13135
|
var idx =
|
|
13137
13136
|
test.parent.tests && test.parent.tests.indexOf(test.retriedTest());
|
|
@@ -13139,7 +13138,7 @@
|
|
|
13139
13138
|
}
|
|
13140
13139
|
self.checkGlobals(test);
|
|
13141
13140
|
});
|
|
13142
|
-
this.on(constants$1.EVENT_HOOK_END, function(hook) {
|
|
13141
|
+
this.on(constants$1.EVENT_HOOK_END, function (hook) {
|
|
13143
13142
|
self.checkGlobals(hook);
|
|
13144
13143
|
});
|
|
13145
13144
|
this._defaultGrep = /.*/;
|
|
@@ -13188,7 +13187,7 @@
|
|
|
13188
13187
|
* @param {string} fn - Listener function
|
|
13189
13188
|
* @private
|
|
13190
13189
|
*/
|
|
13191
|
-
Runner.prototype._addEventListener = function(target, eventName, listener) {
|
|
13190
|
+
Runner.prototype._addEventListener = function (target, eventName, listener) {
|
|
13192
13191
|
debug(
|
|
13193
13192
|
'_addEventListener(): adding for event %s; %d current listeners',
|
|
13194
13193
|
eventName,
|
|
@@ -13198,10 +13197,7 @@
|
|
|
13198
13197
|
if (
|
|
13199
13198
|
this._eventListeners.has(target) &&
|
|
13200
13199
|
this._eventListeners.get(target).has(eventName) &&
|
|
13201
|
-
this._eventListeners
|
|
13202
|
-
.get(target)
|
|
13203
|
-
.get(eventName)
|
|
13204
|
-
.has(listener)
|
|
13200
|
+
this._eventListeners.get(target).get(eventName).has(listener)
|
|
13205
13201
|
) {
|
|
13206
13202
|
debug(
|
|
13207
13203
|
'warning: tried to attach duplicate event listener for %s',
|
|
@@ -13228,7 +13224,7 @@
|
|
|
13228
13224
|
* @param {function} listener - Listener function
|
|
13229
13225
|
* @private
|
|
13230
13226
|
*/
|
|
13231
|
-
Runner.prototype._removeEventListener = function(target, eventName, listener) {
|
|
13227
|
+
Runner.prototype._removeEventListener = function (target, eventName, listener) {
|
|
13232
13228
|
target.removeListener(eventName, listener);
|
|
13233
13229
|
|
|
13234
13230
|
if (this._eventListeners.has(target)) {
|
|
@@ -13252,7 +13248,7 @@
|
|
|
13252
13248
|
* Removes all event handlers set during a run on this instance.
|
|
13253
13249
|
* Remark: this does _not_ clean/dispose the tests or suites themselves.
|
|
13254
13250
|
*/
|
|
13255
|
-
Runner.prototype.dispose = function() {
|
|
13251
|
+
Runner.prototype.dispose = function () {
|
|
13256
13252
|
this.removeAllListeners();
|
|
13257
13253
|
this._eventListeners.forEach((targetListeners, target) => {
|
|
13258
13254
|
targetListeners.forEach((targetEventListeners, eventName) => {
|
|
@@ -13274,7 +13270,7 @@
|
|
|
13274
13270
|
* @param {boolean} invert
|
|
13275
13271
|
* @return {Runner} Runner instance.
|
|
13276
13272
|
*/
|
|
13277
|
-
Runner.prototype.grep = function(re, invert) {
|
|
13273
|
+
Runner.prototype.grep = function (re, invert) {
|
|
13278
13274
|
debug('grep(): setting to %s', re);
|
|
13279
13275
|
this._grep = re;
|
|
13280
13276
|
this._invert = invert;
|
|
@@ -13291,11 +13287,11 @@
|
|
|
13291
13287
|
* @param {Suite} suite
|
|
13292
13288
|
* @return {number}
|
|
13293
13289
|
*/
|
|
13294
|
-
Runner.prototype.grepTotal = function(suite) {
|
|
13290
|
+
Runner.prototype.grepTotal = function (suite) {
|
|
13295
13291
|
var self = this;
|
|
13296
13292
|
var total = 0;
|
|
13297
13293
|
|
|
13298
|
-
suite.eachTest(function(test) {
|
|
13294
|
+
suite.eachTest(function (test) {
|
|
13299
13295
|
var match = self._grep.test(test.fullTitle());
|
|
13300
13296
|
if (self._invert) {
|
|
13301
13297
|
match = !match;
|
|
@@ -13314,7 +13310,7 @@
|
|
|
13314
13310
|
* @return {Array}
|
|
13315
13311
|
* @private
|
|
13316
13312
|
*/
|
|
13317
|
-
Runner.prototype.globalProps = function() {
|
|
13313
|
+
Runner.prototype.globalProps = function () {
|
|
13318
13314
|
var props = Object.keys(commonjsGlobal);
|
|
13319
13315
|
|
|
13320
13316
|
// non-enumerables
|
|
@@ -13336,7 +13332,7 @@
|
|
|
13336
13332
|
* @param {Array} arr
|
|
13337
13333
|
* @return {Runner} Runner instance.
|
|
13338
13334
|
*/
|
|
13339
|
-
Runner.prototype.globals = function(arr) {
|
|
13335
|
+
Runner.prototype.globals = function (arr) {
|
|
13340
13336
|
if (!arguments.length) {
|
|
13341
13337
|
return this._globals;
|
|
13342
13338
|
}
|
|
@@ -13350,7 +13346,7 @@
|
|
|
13350
13346
|
*
|
|
13351
13347
|
* @private
|
|
13352
13348
|
*/
|
|
13353
|
-
Runner.prototype.checkGlobals = function(test) {
|
|
13349
|
+
Runner.prototype.checkGlobals = function (test) {
|
|
13354
13350
|
if (!this.checkLeaks) {
|
|
13355
13351
|
return;
|
|
13356
13352
|
}
|
|
@@ -13398,7 +13394,7 @@
|
|
|
13398
13394
|
* @param {Error} err
|
|
13399
13395
|
* @param {boolean} [force=false] - Whether to fail a pending test.
|
|
13400
13396
|
*/
|
|
13401
|
-
Runner.prototype.fail = function(test, err, force) {
|
|
13397
|
+
Runner.prototype.fail = function (test, err, force) {
|
|
13402
13398
|
force = force === true;
|
|
13403
13399
|
if (test.isPending() && !force) {
|
|
13404
13400
|
return;
|
|
@@ -13439,7 +13435,7 @@
|
|
|
13439
13435
|
* @param {Function} fn
|
|
13440
13436
|
*/
|
|
13441
13437
|
|
|
13442
|
-
Runner.prototype.hook = function(name, fn) {
|
|
13438
|
+
Runner.prototype.hook = function (name, fn) {
|
|
13443
13439
|
if (this._opts.dryRun) return fn();
|
|
13444
13440
|
|
|
13445
13441
|
var suite = this.suite;
|
|
@@ -13468,7 +13464,7 @@
|
|
|
13468
13464
|
self.emit(constants$1.EVENT_HOOK_BEGIN, hook);
|
|
13469
13465
|
|
|
13470
13466
|
if (!hook.listeners('error').length) {
|
|
13471
|
-
self._addEventListener(hook, 'error', function(err) {
|
|
13467
|
+
self._addEventListener(hook, 'error', function (err) {
|
|
13472
13468
|
self.fail(hook, err);
|
|
13473
13469
|
});
|
|
13474
13470
|
}
|
|
@@ -13493,10 +13489,10 @@
|
|
|
13493
13489
|
hook.pending = false; // activates hook for next test
|
|
13494
13490
|
return fn(new Error('abort hookDown'));
|
|
13495
13491
|
} else if (name === HOOK_TYPE_BEFORE_ALL) {
|
|
13496
|
-
suite.tests.forEach(function(test) {
|
|
13492
|
+
suite.tests.forEach(function (test) {
|
|
13497
13493
|
test.pending = true;
|
|
13498
13494
|
});
|
|
13499
|
-
suite.suites.forEach(function(suite) {
|
|
13495
|
+
suite.suites.forEach(function (suite) {
|
|
13500
13496
|
suite.pending = true;
|
|
13501
13497
|
});
|
|
13502
13498
|
hooks = [];
|
|
@@ -13533,7 +13529,7 @@
|
|
|
13533
13529
|
}
|
|
13534
13530
|
}
|
|
13535
13531
|
|
|
13536
|
-
Runner.immediately(function() {
|
|
13532
|
+
Runner.immediately(function () {
|
|
13537
13533
|
next(0);
|
|
13538
13534
|
});
|
|
13539
13535
|
};
|
|
@@ -13547,7 +13543,7 @@
|
|
|
13547
13543
|
* @param {Array} suites
|
|
13548
13544
|
* @param {Function} fn
|
|
13549
13545
|
*/
|
|
13550
|
-
Runner.prototype.hooks = function(name, suites, fn) {
|
|
13546
|
+
Runner.prototype.hooks = function (name, suites, fn) {
|
|
13551
13547
|
var self = this;
|
|
13552
13548
|
var orig = this.suite;
|
|
13553
13549
|
|
|
@@ -13559,7 +13555,7 @@
|
|
|
13559
13555
|
return fn();
|
|
13560
13556
|
}
|
|
13561
13557
|
|
|
13562
|
-
self.hook(name, function(err) {
|
|
13558
|
+
self.hook(name, function (err) {
|
|
13563
13559
|
if (err) {
|
|
13564
13560
|
var errSuite = self.suite;
|
|
13565
13561
|
self.suite = orig;
|
|
@@ -13580,7 +13576,7 @@
|
|
|
13580
13576
|
* @param {Function} fn
|
|
13581
13577
|
* @private
|
|
13582
13578
|
*/
|
|
13583
|
-
Runner.prototype.hookUp = function(name, fn) {
|
|
13579
|
+
Runner.prototype.hookUp = function (name, fn) {
|
|
13584
13580
|
var suites = [this.suite].concat(this.parents()).reverse();
|
|
13585
13581
|
this.hooks(name, suites, fn);
|
|
13586
13582
|
};
|
|
@@ -13592,7 +13588,7 @@
|
|
|
13592
13588
|
* @param {Function} fn
|
|
13593
13589
|
* @private
|
|
13594
13590
|
*/
|
|
13595
|
-
Runner.prototype.hookDown = function(name, fn) {
|
|
13591
|
+
Runner.prototype.hookDown = function (name, fn) {
|
|
13596
13592
|
var suites = [this.suite].concat(this.parents());
|
|
13597
13593
|
this.hooks(name, suites, fn);
|
|
13598
13594
|
};
|
|
@@ -13604,7 +13600,7 @@
|
|
|
13604
13600
|
* @return {Array}
|
|
13605
13601
|
* @private
|
|
13606
13602
|
*/
|
|
13607
|
-
Runner.prototype.parents = function() {
|
|
13603
|
+
Runner.prototype.parents = function () {
|
|
13608
13604
|
var suite = this.suite;
|
|
13609
13605
|
var suites = [];
|
|
13610
13606
|
while (suite.parent) {
|
|
@@ -13620,7 +13616,7 @@
|
|
|
13620
13616
|
* @param {Function} fn
|
|
13621
13617
|
* @private
|
|
13622
13618
|
*/
|
|
13623
|
-
Runner.prototype.runTest = function(fn) {
|
|
13619
|
+
Runner.prototype.runTest = function (fn) {
|
|
13624
13620
|
if (this._opts.dryRun) return fn();
|
|
13625
13621
|
|
|
13626
13622
|
var self = this;
|
|
@@ -13633,7 +13629,7 @@
|
|
|
13633
13629
|
if (this.asyncOnly) {
|
|
13634
13630
|
test.asyncOnly = true;
|
|
13635
13631
|
}
|
|
13636
|
-
this._addEventListener(test, 'error', function(err) {
|
|
13632
|
+
this._addEventListener(test, 'error', function (err) {
|
|
13637
13633
|
self.fail(test, err);
|
|
13638
13634
|
});
|
|
13639
13635
|
if (this.allowUncaught) {
|
|
@@ -13654,7 +13650,7 @@
|
|
|
13654
13650
|
* @param {Suite} suite
|
|
13655
13651
|
* @param {Function} fn
|
|
13656
13652
|
*/
|
|
13657
|
-
Runner.prototype.runTests = function(suite, fn) {
|
|
13653
|
+
Runner.prototype.runTests = function (suite, fn) {
|
|
13658
13654
|
var self = this;
|
|
13659
13655
|
var tests = suite.tests.slice();
|
|
13660
13656
|
var test;
|
|
@@ -13668,7 +13664,7 @@
|
|
|
13668
13664
|
self.suite = after ? errSuite.parent : errSuite;
|
|
13669
13665
|
|
|
13670
13666
|
if (self.suite) {
|
|
13671
|
-
self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
|
|
13667
|
+
self.hookUp(HOOK_TYPE_AFTER_EACH, function (err2, errSuite2) {
|
|
13672
13668
|
self.suite = orig;
|
|
13673
13669
|
// some hooks may fail even now
|
|
13674
13670
|
if (err2) {
|
|
@@ -13742,7 +13738,7 @@
|
|
|
13742
13738
|
|
|
13743
13739
|
// execute test and hook(s)
|
|
13744
13740
|
self.emit(constants$1.EVENT_TEST_BEGIN, (self.test = test));
|
|
13745
|
-
self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
|
|
13741
|
+
self.hookDown(HOOK_TYPE_BEFORE_EACH, function (err, errSuite) {
|
|
13746
13742
|
// conditional skip within beforeEach
|
|
13747
13743
|
if (test.isPending()) {
|
|
13748
13744
|
if (self.forbidPending) {
|
|
@@ -13755,7 +13751,7 @@
|
|
|
13755
13751
|
// skip inner afterEach hooks below errSuite level
|
|
13756
13752
|
var origSuite = self.suite;
|
|
13757
13753
|
self.suite = errSuite || self.suite;
|
|
13758
|
-
return self.hookUp(HOOK_TYPE_AFTER_EACH, function(e, eSuite) {
|
|
13754
|
+
return self.hookUp(HOOK_TYPE_AFTER_EACH, function (e, eSuite) {
|
|
13759
13755
|
self.suite = origSuite;
|
|
13760
13756
|
next(e, eSuite);
|
|
13761
13757
|
});
|
|
@@ -13764,7 +13760,7 @@
|
|
|
13764
13760
|
return hookErr(err, errSuite, false);
|
|
13765
13761
|
}
|
|
13766
13762
|
self.currentRunnable = self.test;
|
|
13767
|
-
self.runTest(function(err) {
|
|
13763
|
+
self.runTest(function (err) {
|
|
13768
13764
|
test = self.test;
|
|
13769
13765
|
// conditional skip within it
|
|
13770
13766
|
if (test.pending) {
|
|
@@ -13815,7 +13811,7 @@
|
|
|
13815
13811
|
* @param {Suite} suite
|
|
13816
13812
|
* @param {Function} fn
|
|
13817
13813
|
*/
|
|
13818
|
-
Runner.prototype.runSuite = function(suite, fn) {
|
|
13814
|
+
Runner.prototype.runSuite = function (suite, fn) {
|
|
13819
13815
|
var i = 0;
|
|
13820
13816
|
var self = this;
|
|
13821
13817
|
var total = this.grepTotal(suite);
|
|
@@ -13855,7 +13851,7 @@
|
|
|
13855
13851
|
// huge recursive loop and thus a maximum call stack error.
|
|
13856
13852
|
// See comment in `this.runTests()` for more information.
|
|
13857
13853
|
if (self._grep !== self._defaultGrep) {
|
|
13858
|
-
Runner.immediately(function() {
|
|
13854
|
+
Runner.immediately(function () {
|
|
13859
13855
|
self.runSuite(curr, next);
|
|
13860
13856
|
});
|
|
13861
13857
|
} else {
|
|
@@ -13870,7 +13866,7 @@
|
|
|
13870
13866
|
// remove reference to test
|
|
13871
13867
|
delete self.test;
|
|
13872
13868
|
|
|
13873
|
-
self.hook(HOOK_TYPE_AFTER_ALL, function() {
|
|
13869
|
+
self.hook(HOOK_TYPE_AFTER_ALL, function () {
|
|
13874
13870
|
self.emit(constants$1.EVENT_SUITE_END, suite);
|
|
13875
13871
|
fn(errSuite);
|
|
13876
13872
|
});
|
|
@@ -13878,7 +13874,7 @@
|
|
|
13878
13874
|
|
|
13879
13875
|
this.nextSuite = next;
|
|
13880
13876
|
|
|
13881
|
-
this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
|
|
13877
|
+
this.hook(HOOK_TYPE_BEFORE_ALL, function (err) {
|
|
13882
13878
|
if (err) {
|
|
13883
13879
|
return done();
|
|
13884
13880
|
}
|
|
@@ -13902,7 +13898,7 @@
|
|
|
13902
13898
|
* @param {Error} err - Some uncaught error
|
|
13903
13899
|
* @private
|
|
13904
13900
|
*/
|
|
13905
|
-
Runner.prototype._uncaught = function(err) {
|
|
13901
|
+
Runner.prototype._uncaught = function (err) {
|
|
13906
13902
|
// this is defensive to prevent future developers from mis-calling this function.
|
|
13907
13903
|
// it's more likely that it'd be called with the incorrect context--say, the global
|
|
13908
13904
|
// `process` object--than it would to be called with a context that is not a "subclass"
|
|
@@ -14000,12 +13996,12 @@
|
|
|
14000
13996
|
* @param {{files: string[], options: Options}} [opts] - For subclasses
|
|
14001
13997
|
* @returns {Runner} Runner instance.
|
|
14002
13998
|
*/
|
|
14003
|
-
Runner.prototype.run = function(fn, opts = {}) {
|
|
13999
|
+
Runner.prototype.run = function (fn, opts = {}) {
|
|
14004
14000
|
var rootSuite = this.suite;
|
|
14005
14001
|
var options = opts.options || {};
|
|
14006
14002
|
|
|
14007
14003
|
debug('run(): got options: %O', options);
|
|
14008
|
-
fn = fn || function() {};
|
|
14004
|
+
fn = fn || function () {};
|
|
14009
14005
|
|
|
14010
14006
|
const end = () => {
|
|
14011
14007
|
if (!this.total && this._opts.failZero) this.failures = 1;
|
|
@@ -14046,7 +14042,7 @@
|
|
|
14046
14042
|
}
|
|
14047
14043
|
|
|
14048
14044
|
// callback
|
|
14049
|
-
this.on(constants$1.EVENT_RUN_END, function() {
|
|
14045
|
+
this.on(constants$1.EVENT_RUN_END, function () {
|
|
14050
14046
|
this.state = constants$1.STATE_STOPPED;
|
|
14051
14047
|
debug('run(): emitted %s', constants$1.EVENT_RUN_END);
|
|
14052
14048
|
fn(this.failures);
|
|
@@ -14093,7 +14089,7 @@
|
|
|
14093
14089
|
* }
|
|
14094
14090
|
* }
|
|
14095
14091
|
*/
|
|
14096
|
-
Runner.prototype.linkPartialObjects = function(value) {
|
|
14092
|
+
Runner.prototype.linkPartialObjects = function (value) {
|
|
14097
14093
|
return this;
|
|
14098
14094
|
};
|
|
14099
14095
|
|
|
@@ -14118,7 +14114,7 @@
|
|
|
14118
14114
|
* @public
|
|
14119
14115
|
* @return {Runner} Runner instance.
|
|
14120
14116
|
*/
|
|
14121
|
-
Runner.prototype.abort = function() {
|
|
14117
|
+
Runner.prototype.abort = function () {
|
|
14122
14118
|
debug('abort(): aborting');
|
|
14123
14119
|
this._abort = true;
|
|
14124
14120
|
|
|
@@ -14146,7 +14142,7 @@
|
|
|
14146
14142
|
* @chainable
|
|
14147
14143
|
* @abstract
|
|
14148
14144
|
*/
|
|
14149
|
-
Runner.prototype.workerReporter = function() {
|
|
14145
|
+
Runner.prototype.workerReporter = function () {
|
|
14150
14146
|
throw createUnsupportedError$1('workerReporter() not supported in serial mode');
|
|
14151
14147
|
};
|
|
14152
14148
|
|
|
@@ -14159,7 +14155,7 @@
|
|
|
14159
14155
|
* @return {Array}
|
|
14160
14156
|
*/
|
|
14161
14157
|
function filterLeaks(ok, globals) {
|
|
14162
|
-
return globals.filter(function(key) {
|
|
14158
|
+
return globals.filter(function (key) {
|
|
14163
14159
|
// Firefox and Chrome exposes iframes as index inside the window object
|
|
14164
14160
|
if (/^\d+/.test(key)) {
|
|
14165
14161
|
return false;
|
|
@@ -14183,7 +14179,7 @@
|
|
|
14183
14179
|
return false;
|
|
14184
14180
|
}
|
|
14185
14181
|
|
|
14186
|
-
var matched = ok.filter(function(ok) {
|
|
14182
|
+
var matched = ok.filter(function (ok) {
|
|
14187
14183
|
if (~ok.indexOf('*')) {
|
|
14188
14184
|
return key.indexOf(ok.split('*')[0]) === 0;
|
|
14189
14185
|
}
|
|
@@ -14342,7 +14338,7 @@
|
|
|
14342
14338
|
* @param {string} str
|
|
14343
14339
|
* @return {string}
|
|
14344
14340
|
*/
|
|
14345
|
-
var color = (exports.color = function(type, str) {
|
|
14341
|
+
var color = (exports.color = function (type, str) {
|
|
14346
14342
|
if (!exports.useColors) {
|
|
14347
14343
|
return String(str);
|
|
14348
14344
|
}
|
|
@@ -14370,23 +14366,23 @@
|
|
|
14370
14366
|
*/
|
|
14371
14367
|
|
|
14372
14368
|
exports.cursor = {
|
|
14373
|
-
hide: function() {
|
|
14369
|
+
hide: function () {
|
|
14374
14370
|
isatty && process$1.stdout.write('\u001b[?25l');
|
|
14375
14371
|
},
|
|
14376
14372
|
|
|
14377
|
-
show: function() {
|
|
14373
|
+
show: function () {
|
|
14378
14374
|
isatty && process$1.stdout.write('\u001b[?25h');
|
|
14379
14375
|
},
|
|
14380
14376
|
|
|
14381
|
-
deleteLine: function() {
|
|
14377
|
+
deleteLine: function () {
|
|
14382
14378
|
isatty && process$1.stdout.write('\u001b[2K');
|
|
14383
14379
|
},
|
|
14384
14380
|
|
|
14385
|
-
beginningOfLine: function() {
|
|
14381
|
+
beginningOfLine: function () {
|
|
14386
14382
|
isatty && process$1.stdout.write('\u001b[0G');
|
|
14387
14383
|
},
|
|
14388
14384
|
|
|
14389
|
-
CR: function() {
|
|
14385
|
+
CR: function () {
|
|
14390
14386
|
if (isatty) {
|
|
14391
14387
|
exports.cursor.deleteLine();
|
|
14392
14388
|
exports.cursor.beginningOfLine();
|
|
@@ -14396,7 +14392,7 @@
|
|
|
14396
14392
|
}
|
|
14397
14393
|
};
|
|
14398
14394
|
|
|
14399
|
-
var showDiff = (exports.showDiff = function(err) {
|
|
14395
|
+
var showDiff = (exports.showDiff = function (err) {
|
|
14400
14396
|
return (
|
|
14401
14397
|
err &&
|
|
14402
14398
|
err.showDiff !== false &&
|
|
@@ -14423,7 +14419,7 @@
|
|
|
14423
14419
|
* @param {string} expected
|
|
14424
14420
|
* @return {string} Diff
|
|
14425
14421
|
*/
|
|
14426
|
-
var generateDiff = (exports.generateDiff = function(actual, expected) {
|
|
14422
|
+
var generateDiff = (exports.generateDiff = function (actual, expected) {
|
|
14427
14423
|
try {
|
|
14428
14424
|
const diffSize = 2048;
|
|
14429
14425
|
if (actual.length > diffSize) {
|
|
@@ -14455,10 +14451,10 @@
|
|
|
14455
14451
|
* @param {Object[]} failures - Each is Test instance with corresponding
|
|
14456
14452
|
* Error property
|
|
14457
14453
|
*/
|
|
14458
|
-
exports.list = function(failures) {
|
|
14454
|
+
exports.list = function (failures) {
|
|
14459
14455
|
var multipleErr, multipleTest;
|
|
14460
14456
|
Base.consoleLog();
|
|
14461
|
-
failures.forEach(function(test, i) {
|
|
14457
|
+
failures.forEach(function (test, i) {
|
|
14462
14458
|
// format
|
|
14463
14459
|
var fmt =
|
|
14464
14460
|
color('error title', ' %s) %s:\n') +
|
|
@@ -14517,7 +14513,7 @@
|
|
|
14517
14513
|
|
|
14518
14514
|
// indented test title
|
|
14519
14515
|
var testTitle = '';
|
|
14520
|
-
test.titlePath().forEach(function(str, index) {
|
|
14516
|
+
test.titlePath().forEach(function (str, index) {
|
|
14521
14517
|
if (index !== 0) {
|
|
14522
14518
|
testTitle += '\n ';
|
|
14523
14519
|
}
|
|
@@ -14553,7 +14549,7 @@
|
|
|
14553
14549
|
this.runner = runner;
|
|
14554
14550
|
this.stats = runner.stats; // assigned so Reporters keep a closer reference
|
|
14555
14551
|
|
|
14556
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
14552
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
14557
14553
|
if (test.duration > test.slow()) {
|
|
14558
14554
|
test.speed = 'slow';
|
|
14559
14555
|
} else if (test.duration > test.slow() / 2) {
|
|
@@ -14563,7 +14559,7 @@
|
|
|
14563
14559
|
}
|
|
14564
14560
|
});
|
|
14565
14561
|
|
|
14566
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
14562
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
14567
14563
|
if (showDiff(err)) {
|
|
14568
14564
|
stringifyDiffObjs(err);
|
|
14569
14565
|
}
|
|
@@ -14583,7 +14579,7 @@
|
|
|
14583
14579
|
* @public
|
|
14584
14580
|
* @memberof Mocha.reporters
|
|
14585
14581
|
*/
|
|
14586
|
-
Base.prototype.epilogue = function() {
|
|
14582
|
+
Base.prototype.epilogue = function () {
|
|
14587
14583
|
var stats = this.stats;
|
|
14588
14584
|
var fmt;
|
|
14589
14585
|
|
|
@@ -14646,7 +14642,7 @@
|
|
|
14646
14642
|
if (lines.length > 4) {
|
|
14647
14643
|
var width = String(lines.length).length;
|
|
14648
14644
|
msg = lines
|
|
14649
|
-
.map(function(str, i) {
|
|
14645
|
+
.map(function (str, i) {
|
|
14650
14646
|
return pad(++i, width) + ' |' + ' ' + str;
|
|
14651
14647
|
})
|
|
14652
14648
|
.join('\n');
|
|
@@ -14703,10 +14699,7 @@
|
|
|
14703
14699
|
' ' +
|
|
14704
14700
|
colorLines('diff removed', '- actual') +
|
|
14705
14701
|
'\n\n' +
|
|
14706
|
-
lines
|
|
14707
|
-
.map(cleanUp)
|
|
14708
|
-
.filter(notBlank)
|
|
14709
|
-
.join('\n')
|
|
14702
|
+
lines.map(cleanUp).filter(notBlank).join('\n')
|
|
14710
14703
|
);
|
|
14711
14704
|
}
|
|
14712
14705
|
|
|
@@ -14721,7 +14714,7 @@
|
|
|
14721
14714
|
function errorDiff(actual, expected) {
|
|
14722
14715
|
return diff$1
|
|
14723
14716
|
.diffWordsWithSpace(actual, expected)
|
|
14724
|
-
.map(function(str) {
|
|
14717
|
+
.map(function (str) {
|
|
14725
14718
|
if (str.added) {
|
|
14726
14719
|
return colorLines('diff added inline', str.value);
|
|
14727
14720
|
}
|
|
@@ -14744,7 +14737,7 @@
|
|
|
14744
14737
|
function colorLines(name, str) {
|
|
14745
14738
|
return str
|
|
14746
14739
|
.split('\n')
|
|
14747
|
-
.map(function(str) {
|
|
14740
|
+
.map(function (str) {
|
|
14748
14741
|
return color(name, str);
|
|
14749
14742
|
})
|
|
14750
14743
|
.join('\n');
|
|
@@ -14812,18 +14805,18 @@
|
|
|
14812
14805
|
var width = (base.window.width * 0.75) | 0;
|
|
14813
14806
|
var n = -1;
|
|
14814
14807
|
|
|
14815
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
14808
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
14816
14809
|
process$1.stdout.write('\n');
|
|
14817
14810
|
});
|
|
14818
14811
|
|
|
14819
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
14812
|
+
runner.on(EVENT_TEST_PENDING, function () {
|
|
14820
14813
|
if (++n % width === 0) {
|
|
14821
14814
|
process$1.stdout.write('\n ');
|
|
14822
14815
|
}
|
|
14823
14816
|
process$1.stdout.write(base.color('pending', base.symbols.comma));
|
|
14824
14817
|
});
|
|
14825
14818
|
|
|
14826
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
14819
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
14827
14820
|
if (++n % width === 0) {
|
|
14828
14821
|
process$1.stdout.write('\n ');
|
|
14829
14822
|
}
|
|
@@ -14834,14 +14827,14 @@
|
|
|
14834
14827
|
}
|
|
14835
14828
|
});
|
|
14836
14829
|
|
|
14837
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
14830
|
+
runner.on(EVENT_TEST_FAIL, function () {
|
|
14838
14831
|
if (++n % width === 0) {
|
|
14839
14832
|
process$1.stdout.write('\n ');
|
|
14840
14833
|
}
|
|
14841
14834
|
process$1.stdout.write(base.color('fail', base.symbols.bang));
|
|
14842
14835
|
});
|
|
14843
14836
|
|
|
14844
|
-
runner.once(EVENT_RUN_END, function() {
|
|
14837
|
+
runner.once(EVENT_RUN_END, function () {
|
|
14845
14838
|
process$1.stdout.write('\n');
|
|
14846
14839
|
self.epilogue();
|
|
14847
14840
|
});
|
|
@@ -14896,7 +14889,7 @@
|
|
|
14896
14889
|
return Array(indents).join(' ');
|
|
14897
14890
|
}
|
|
14898
14891
|
|
|
14899
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
14892
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
14900
14893
|
if (suite.root) {
|
|
14901
14894
|
return;
|
|
14902
14895
|
}
|
|
@@ -14907,7 +14900,7 @@
|
|
|
14907
14900
|
base.consoleLog('%s<dl>', indent());
|
|
14908
14901
|
});
|
|
14909
14902
|
|
|
14910
|
-
runner.on(EVENT_SUITE_END, function(suite) {
|
|
14903
|
+
runner.on(EVENT_SUITE_END, function (suite) {
|
|
14911
14904
|
if (suite.root) {
|
|
14912
14905
|
return;
|
|
14913
14906
|
}
|
|
@@ -14917,14 +14910,14 @@
|
|
|
14917
14910
|
--indents;
|
|
14918
14911
|
});
|
|
14919
14912
|
|
|
14920
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
14913
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
14921
14914
|
base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.title));
|
|
14922
14915
|
base.consoleLog('%s <dt>%s</dt>', indent(), utils.escape(test.file));
|
|
14923
14916
|
var code = utils.escape(utils.clean(test.body));
|
|
14924
14917
|
base.consoleLog('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
|
|
14925
14918
|
});
|
|
14926
14919
|
|
|
14927
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
14920
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
14928
14921
|
base.consoleLog(
|
|
14929
14922
|
'%s <dt class="error">%s</dt>',
|
|
14930
14923
|
indent(),
|
|
@@ -15003,27 +14996,27 @@
|
|
|
15003
14996
|
|
|
15004
14997
|
this._producer = createProducer(tapVersion);
|
|
15005
14998
|
|
|
15006
|
-
runner.once(EVENT_RUN_BEGIN, function() {
|
|
14999
|
+
runner.once(EVENT_RUN_BEGIN, function () {
|
|
15007
15000
|
self._producer.writeVersion();
|
|
15008
15001
|
});
|
|
15009
15002
|
|
|
15010
|
-
runner.on(EVENT_TEST_END, function() {
|
|
15003
|
+
runner.on(EVENT_TEST_END, function () {
|
|
15011
15004
|
++n;
|
|
15012
15005
|
});
|
|
15013
15006
|
|
|
15014
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15007
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15015
15008
|
self._producer.writePending(n, test);
|
|
15016
15009
|
});
|
|
15017
15010
|
|
|
15018
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15011
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15019
15012
|
self._producer.writePass(n, test);
|
|
15020
15013
|
});
|
|
15021
15014
|
|
|
15022
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
15015
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
15023
15016
|
self._producer.writeFail(n, test, err);
|
|
15024
15017
|
});
|
|
15025
15018
|
|
|
15026
|
-
runner.once(EVENT_RUN_END, function() {
|
|
15019
|
+
runner.once(EVENT_RUN_END, function () {
|
|
15027
15020
|
self._producer.writeEpilogue(runner.stats);
|
|
15028
15021
|
});
|
|
15029
15022
|
}
|
|
@@ -15067,8 +15060,8 @@
|
|
|
15067
15060
|
*/
|
|
15068
15061
|
function createProducer(tapVersion) {
|
|
15069
15062
|
var producers = {
|
|
15070
|
-
|
|
15071
|
-
|
|
15063
|
+
12: new TAP12Producer(),
|
|
15064
|
+
13: new TAP13Producer()
|
|
15072
15065
|
};
|
|
15073
15066
|
var producer = producers[tapVersion];
|
|
15074
15067
|
|
|
@@ -15098,7 +15091,7 @@
|
|
|
15098
15091
|
*
|
|
15099
15092
|
* @abstract
|
|
15100
15093
|
*/
|
|
15101
|
-
TAPProducer.prototype.writeVersion = function() {};
|
|
15094
|
+
TAPProducer.prototype.writeVersion = function () {};
|
|
15102
15095
|
|
|
15103
15096
|
/**
|
|
15104
15097
|
* Writes the plan to reporter output stream.
|
|
@@ -15106,7 +15099,7 @@
|
|
|
15106
15099
|
* @abstract
|
|
15107
15100
|
* @param {number} ntests - Number of tests that are planned to run.
|
|
15108
15101
|
*/
|
|
15109
|
-
TAPProducer.prototype.writePlan = function(ntests) {
|
|
15102
|
+
TAPProducer.prototype.writePlan = function (ntests) {
|
|
15110
15103
|
println('%d..%d', 1, ntests);
|
|
15111
15104
|
};
|
|
15112
15105
|
|
|
@@ -15117,7 +15110,7 @@
|
|
|
15117
15110
|
* @param {number} n - Index of test that passed.
|
|
15118
15111
|
* @param {Test} test - Instance containing test information.
|
|
15119
15112
|
*/
|
|
15120
|
-
TAPProducer.prototype.writePass = function(n, test) {
|
|
15113
|
+
TAPProducer.prototype.writePass = function (n, test) {
|
|
15121
15114
|
println('ok %d %s', n, title(test));
|
|
15122
15115
|
};
|
|
15123
15116
|
|
|
@@ -15128,7 +15121,7 @@
|
|
|
15128
15121
|
* @param {number} n - Index of test that was skipped.
|
|
15129
15122
|
* @param {Test} test - Instance containing test information.
|
|
15130
15123
|
*/
|
|
15131
|
-
TAPProducer.prototype.writePending = function(n, test) {
|
|
15124
|
+
TAPProducer.prototype.writePending = function (n, test) {
|
|
15132
15125
|
println('ok %d %s # SKIP -', n, title(test));
|
|
15133
15126
|
};
|
|
15134
15127
|
|
|
@@ -15140,7 +15133,7 @@
|
|
|
15140
15133
|
* @param {Test} test - Instance containing test information.
|
|
15141
15134
|
* @param {Error} err - Reason the test failed.
|
|
15142
15135
|
*/
|
|
15143
|
-
TAPProducer.prototype.writeFail = function(n, test, err) {
|
|
15136
|
+
TAPProducer.prototype.writeFail = function (n, test, err) {
|
|
15144
15137
|
println('not ok %d %s', n, title(test));
|
|
15145
15138
|
};
|
|
15146
15139
|
|
|
@@ -15150,7 +15143,7 @@
|
|
|
15150
15143
|
* @abstract
|
|
15151
15144
|
* @param {Object} stats - Object containing run statistics.
|
|
15152
15145
|
*/
|
|
15153
|
-
TAPProducer.prototype.writeEpilogue = function(stats) {
|
|
15146
|
+
TAPProducer.prototype.writeEpilogue = function (stats) {
|
|
15154
15147
|
// :TBD: Why is this not counting pending tests?
|
|
15155
15148
|
println('# tests ' + (stats.passes + stats.failures));
|
|
15156
15149
|
println('# pass ' + stats.passes);
|
|
@@ -15176,7 +15169,7 @@
|
|
|
15176
15169
|
* Writes that test failed to reporter output stream, with error formatting.
|
|
15177
15170
|
* @override
|
|
15178
15171
|
*/
|
|
15179
|
-
this.writeFail = function(n, test, err) {
|
|
15172
|
+
this.writeFail = function (n, test, err) {
|
|
15180
15173
|
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
15181
15174
|
if (err.message) {
|
|
15182
15175
|
println(err.message.replace(/^/gm, ' '));
|
|
@@ -15209,7 +15202,7 @@
|
|
|
15209
15202
|
* Writes the TAP version to reporter output stream.
|
|
15210
15203
|
* @override
|
|
15211
15204
|
*/
|
|
15212
|
-
this.writeVersion = function() {
|
|
15205
|
+
this.writeVersion = function () {
|
|
15213
15206
|
println('TAP version 13');
|
|
15214
15207
|
};
|
|
15215
15208
|
|
|
@@ -15217,7 +15210,7 @@
|
|
|
15217
15210
|
* Writes that test failed to reporter output stream, with error formatting.
|
|
15218
15211
|
* @override
|
|
15219
15212
|
*/
|
|
15220
|
-
this.writeFail = function(n, test, err) {
|
|
15213
|
+
this.writeFail = function (n, test, err) {
|
|
15221
15214
|
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
15222
15215
|
var emitYamlBlock = err.message != null || err.stack != null;
|
|
15223
15216
|
if (emitYamlBlock) {
|
|
@@ -15302,23 +15295,23 @@
|
|
|
15302
15295
|
output = options.reporterOption.output;
|
|
15303
15296
|
}
|
|
15304
15297
|
|
|
15305
|
-
runner.on(EVENT_TEST_END, function(test) {
|
|
15298
|
+
runner.on(EVENT_TEST_END, function (test) {
|
|
15306
15299
|
tests.push(test);
|
|
15307
15300
|
});
|
|
15308
15301
|
|
|
15309
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15302
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15310
15303
|
passes.push(test);
|
|
15311
15304
|
});
|
|
15312
15305
|
|
|
15313
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
15306
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
15314
15307
|
failures.push(test);
|
|
15315
15308
|
});
|
|
15316
15309
|
|
|
15317
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15310
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15318
15311
|
pending.push(test);
|
|
15319
15312
|
});
|
|
15320
15313
|
|
|
15321
|
-
runner.once(EVENT_RUN_END, function() {
|
|
15314
|
+
runner.once(EVENT_RUN_END, function () {
|
|
15322
15315
|
var obj = {
|
|
15323
15316
|
stats: self.stats,
|
|
15324
15317
|
tests: tests.map(clean),
|
|
@@ -15381,7 +15374,7 @@
|
|
|
15381
15374
|
function cleanCycles(obj) {
|
|
15382
15375
|
var cache = [];
|
|
15383
15376
|
return JSON.parse(
|
|
15384
|
-
JSON.stringify(obj, function(key, value) {
|
|
15377
|
+
JSON.stringify(obj, function (key, value) {
|
|
15385
15378
|
if (typeof value === 'object' && value !== null) {
|
|
15386
15379
|
if (cache.indexOf(value) !== -1) {
|
|
15387
15380
|
// Instead of going in a circle, we'll print [object Object]
|
|
@@ -15404,7 +15397,7 @@
|
|
|
15404
15397
|
*/
|
|
15405
15398
|
function errorJSON(err) {
|
|
15406
15399
|
var res = {};
|
|
15407
|
-
Object.getOwnPropertyNames(err).forEach(function(key) {
|
|
15400
|
+
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
15408
15401
|
res[key] = err[key];
|
|
15409
15402
|
}, err);
|
|
15410
15403
|
return res;
|
|
@@ -15440,7 +15433,7 @@
|
|
|
15440
15433
|
* @param {number} size
|
|
15441
15434
|
* @return {Progress} Progress instance.
|
|
15442
15435
|
*/
|
|
15443
|
-
Progress.prototype.size = function(size) {
|
|
15436
|
+
Progress.prototype.size = function (size) {
|
|
15444
15437
|
this._size = size;
|
|
15445
15438
|
return this;
|
|
15446
15439
|
};
|
|
@@ -15452,7 +15445,7 @@
|
|
|
15452
15445
|
* @param {string} text
|
|
15453
15446
|
* @return {Progress} Progress instance.
|
|
15454
15447
|
*/
|
|
15455
|
-
Progress.prototype.text = function(text) {
|
|
15448
|
+
Progress.prototype.text = function (text) {
|
|
15456
15449
|
this._text = text;
|
|
15457
15450
|
return this;
|
|
15458
15451
|
};
|
|
@@ -15464,7 +15457,7 @@
|
|
|
15464
15457
|
* @param {number} size
|
|
15465
15458
|
* @return {Progress} Progress instance.
|
|
15466
15459
|
*/
|
|
15467
|
-
Progress.prototype.fontSize = function(size) {
|
|
15460
|
+
Progress.prototype.fontSize = function (size) {
|
|
15468
15461
|
this._fontSize = size;
|
|
15469
15462
|
return this;
|
|
15470
15463
|
};
|
|
@@ -15475,7 +15468,7 @@
|
|
|
15475
15468
|
* @param {string} family
|
|
15476
15469
|
* @return {Progress} Progress instance.
|
|
15477
15470
|
*/
|
|
15478
|
-
Progress.prototype.font = function(family) {
|
|
15471
|
+
Progress.prototype.font = function (family) {
|
|
15479
15472
|
this._font = family;
|
|
15480
15473
|
return this;
|
|
15481
15474
|
};
|
|
@@ -15486,7 +15479,7 @@
|
|
|
15486
15479
|
* @param {number} n
|
|
15487
15480
|
* @return {Progress} Progress instance.
|
|
15488
15481
|
*/
|
|
15489
|
-
Progress.prototype.update = function(n) {
|
|
15482
|
+
Progress.prototype.update = function (n) {
|
|
15490
15483
|
this.percent = n;
|
|
15491
15484
|
return this;
|
|
15492
15485
|
};
|
|
@@ -15497,7 +15490,7 @@
|
|
|
15497
15490
|
* @param {CanvasRenderingContext2d} ctx
|
|
15498
15491
|
* @return {Progress} Progress instance.
|
|
15499
15492
|
*/
|
|
15500
|
-
Progress.prototype.draw = function(ctx) {
|
|
15493
|
+
Progress.prototype.draw = function (ctx) {
|
|
15501
15494
|
try {
|
|
15502
15495
|
var percent = Math.min(this.percent, 100);
|
|
15503
15496
|
var size = this._size;
|
|
@@ -15628,7 +15621,7 @@
|
|
|
15628
15621
|
}
|
|
15629
15622
|
|
|
15630
15623
|
// pass toggle
|
|
15631
|
-
on(passesLink, 'click', function(evt) {
|
|
15624
|
+
on(passesLink, 'click', function (evt) {
|
|
15632
15625
|
evt.preventDefault();
|
|
15633
15626
|
unhide();
|
|
15634
15627
|
var name = /pass/.test(report.className) ? '' : ' pass';
|
|
@@ -15639,7 +15632,7 @@
|
|
|
15639
15632
|
});
|
|
15640
15633
|
|
|
15641
15634
|
// failure toggle
|
|
15642
|
-
on(failuresLink, 'click', function(evt) {
|
|
15635
|
+
on(failuresLink, 'click', function (evt) {
|
|
15643
15636
|
evt.preventDefault();
|
|
15644
15637
|
unhide();
|
|
15645
15638
|
var name = /fail/.test(report.className) ? '' : ' fail';
|
|
@@ -15656,7 +15649,7 @@
|
|
|
15656
15649
|
progress.size(40);
|
|
15657
15650
|
}
|
|
15658
15651
|
|
|
15659
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
15652
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
15660
15653
|
if (suite.root) {
|
|
15661
15654
|
return;
|
|
15662
15655
|
}
|
|
@@ -15675,7 +15668,7 @@
|
|
|
15675
15668
|
el.appendChild(stack[0]);
|
|
15676
15669
|
});
|
|
15677
15670
|
|
|
15678
|
-
runner.on(EVENT_SUITE_END, function(suite) {
|
|
15671
|
+
runner.on(EVENT_SUITE_END, function (suite) {
|
|
15679
15672
|
if (suite.root) {
|
|
15680
15673
|
updateStats();
|
|
15681
15674
|
return;
|
|
@@ -15683,7 +15676,7 @@
|
|
|
15683
15676
|
stack.shift();
|
|
15684
15677
|
});
|
|
15685
15678
|
|
|
15686
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15679
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15687
15680
|
var url = self.testURL(test);
|
|
15688
15681
|
var markup =
|
|
15689
15682
|
'<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
|
|
@@ -15696,7 +15689,7 @@
|
|
|
15696
15689
|
updateStats();
|
|
15697
15690
|
});
|
|
15698
15691
|
|
|
15699
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
15692
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
15700
15693
|
var el = fragment(
|
|
15701
15694
|
'<li class="test fail"><h2>%e <a href="%e" class="replay">' +
|
|
15702
15695
|
playIcon +
|
|
@@ -15752,7 +15745,7 @@
|
|
|
15752
15745
|
updateStats();
|
|
15753
15746
|
});
|
|
15754
15747
|
|
|
15755
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15748
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15756
15749
|
var el = fragment(
|
|
15757
15750
|
'<li class="test pass pending"><h2>%e</h2></li>',
|
|
15758
15751
|
test.title
|
|
@@ -15810,7 +15803,7 @@
|
|
|
15810
15803
|
*
|
|
15811
15804
|
* @param {Object} [suite]
|
|
15812
15805
|
*/
|
|
15813
|
-
HTML.prototype.suiteURL = function(suite) {
|
|
15806
|
+
HTML.prototype.suiteURL = function (suite) {
|
|
15814
15807
|
return makeUrl(suite.fullTitle());
|
|
15815
15808
|
};
|
|
15816
15809
|
|
|
@@ -15819,7 +15812,7 @@
|
|
|
15819
15812
|
*
|
|
15820
15813
|
* @param {Object} [test]
|
|
15821
15814
|
*/
|
|
15822
|
-
HTML.prototype.testURL = function(test) {
|
|
15815
|
+
HTML.prototype.testURL = function (test) {
|
|
15823
15816
|
return makeUrl(test.fullTitle());
|
|
15824
15817
|
};
|
|
15825
15818
|
|
|
@@ -15829,10 +15822,10 @@
|
|
|
15829
15822
|
* @param {HTMLLIElement} el
|
|
15830
15823
|
* @param {string} contents
|
|
15831
15824
|
*/
|
|
15832
|
-
HTML.prototype.addCodeToggle = function(el, contents) {
|
|
15825
|
+
HTML.prototype.addCodeToggle = function (el, contents) {
|
|
15833
15826
|
var h2 = el.getElementsByTagName('h2')[0];
|
|
15834
15827
|
|
|
15835
|
-
on(h2, 'click', function() {
|
|
15828
|
+
on(h2, 'click', function () {
|
|
15836
15829
|
pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
|
|
15837
15830
|
});
|
|
15838
15831
|
|
|
@@ -15860,7 +15853,7 @@
|
|
|
15860
15853
|
var div = document.createElement('div');
|
|
15861
15854
|
var i = 1;
|
|
15862
15855
|
|
|
15863
|
-
div.innerHTML = html.replace(/%([se])/g, function(_, type) {
|
|
15856
|
+
div.innerHTML = html.replace(/%([se])/g, function (_, type) {
|
|
15864
15857
|
switch (type) {
|
|
15865
15858
|
case 's':
|
|
15866
15859
|
return String(args[i++]);
|
|
@@ -15969,20 +15962,20 @@
|
|
|
15969
15962
|
var self = this;
|
|
15970
15963
|
var n = 0;
|
|
15971
15964
|
|
|
15972
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
15965
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
15973
15966
|
base.consoleLog();
|
|
15974
15967
|
});
|
|
15975
15968
|
|
|
15976
|
-
runner.on(EVENT_TEST_BEGIN, function(test) {
|
|
15969
|
+
runner.on(EVENT_TEST_BEGIN, function (test) {
|
|
15977
15970
|
process$1.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
|
|
15978
15971
|
});
|
|
15979
15972
|
|
|
15980
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
15973
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
15981
15974
|
var fmt = color('checkmark', ' -') + color('pending', ' %s');
|
|
15982
15975
|
base.consoleLog(fmt, test.fullTitle());
|
|
15983
15976
|
});
|
|
15984
15977
|
|
|
15985
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
15978
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
15986
15979
|
var fmt =
|
|
15987
15980
|
color('checkmark', ' ' + base.symbols.ok) +
|
|
15988
15981
|
color('pass', ' %s: ') +
|
|
@@ -15991,7 +15984,7 @@
|
|
|
15991
15984
|
base.consoleLog(fmt, test.fullTitle(), test.duration);
|
|
15992
15985
|
});
|
|
15993
15986
|
|
|
15994
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
15987
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
15995
15988
|
cursor.CR();
|
|
15996
15989
|
base.consoleLog(color('fail', ' %d) %s'), ++n, test.fullTitle());
|
|
15997
15990
|
});
|
|
@@ -16043,7 +16036,7 @@
|
|
|
16043
16036
|
function Min(runner, options) {
|
|
16044
16037
|
base.call(this, runner, options);
|
|
16045
16038
|
|
|
16046
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16039
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16047
16040
|
// clear screen
|
|
16048
16041
|
process$1.stdout.write('\u001b[2J');
|
|
16049
16042
|
// set cursor position
|
|
@@ -16108,28 +16101,28 @@
|
|
|
16108
16101
|
return Array(indents).join(' ');
|
|
16109
16102
|
}
|
|
16110
16103
|
|
|
16111
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16104
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16112
16105
|
base.consoleLog();
|
|
16113
16106
|
});
|
|
16114
16107
|
|
|
16115
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
16108
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
16116
16109
|
++indents;
|
|
16117
16110
|
base.consoleLog(color('suite', '%s%s'), indent(), suite.title);
|
|
16118
16111
|
});
|
|
16119
16112
|
|
|
16120
|
-
runner.on(EVENT_SUITE_END, function() {
|
|
16113
|
+
runner.on(EVENT_SUITE_END, function () {
|
|
16121
16114
|
--indents;
|
|
16122
16115
|
if (indents === 1) {
|
|
16123
16116
|
base.consoleLog();
|
|
16124
16117
|
}
|
|
16125
16118
|
});
|
|
16126
16119
|
|
|
16127
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
16120
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
16128
16121
|
var fmt = indent() + color('pending', ' - %s');
|
|
16129
16122
|
base.consoleLog(fmt, test.title);
|
|
16130
16123
|
});
|
|
16131
16124
|
|
|
16132
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
16125
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16133
16126
|
var fmt;
|
|
16134
16127
|
if (test.speed === 'fast') {
|
|
16135
16128
|
fmt =
|
|
@@ -16147,7 +16140,7 @@
|
|
|
16147
16140
|
}
|
|
16148
16141
|
});
|
|
16149
16142
|
|
|
16150
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
16143
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
16151
16144
|
base.consoleLog(indent() + color('fail', ' %d) %s'), ++n, test.title);
|
|
16152
16145
|
});
|
|
16153
16146
|
|
|
@@ -16210,24 +16203,24 @@
|
|
|
16210
16203
|
this.trajectories = [[], [], [], []];
|
|
16211
16204
|
this.trajectoryWidthMax = width - nyanCatWidth;
|
|
16212
16205
|
|
|
16213
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16206
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16214
16207
|
base.cursor.hide();
|
|
16215
16208
|
self.draw();
|
|
16216
16209
|
});
|
|
16217
16210
|
|
|
16218
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
16211
|
+
runner.on(EVENT_TEST_PENDING, function () {
|
|
16219
16212
|
self.draw();
|
|
16220
16213
|
});
|
|
16221
16214
|
|
|
16222
|
-
runner.on(EVENT_TEST_PASS, function() {
|
|
16215
|
+
runner.on(EVENT_TEST_PASS, function () {
|
|
16223
16216
|
self.draw();
|
|
16224
16217
|
});
|
|
16225
16218
|
|
|
16226
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
16219
|
+
runner.on(EVENT_TEST_FAIL, function () {
|
|
16227
16220
|
self.draw();
|
|
16228
16221
|
});
|
|
16229
16222
|
|
|
16230
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16223
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16231
16224
|
base.cursor.show();
|
|
16232
16225
|
for (var i = 0; i < self.numberOfLines; i++) {
|
|
16233
16226
|
write('\n');
|
|
@@ -16247,7 +16240,7 @@
|
|
|
16247
16240
|
* @private
|
|
16248
16241
|
*/
|
|
16249
16242
|
|
|
16250
|
-
NyanCat.prototype.draw = function() {
|
|
16243
|
+
NyanCat.prototype.draw = function () {
|
|
16251
16244
|
this.appendRainbow();
|
|
16252
16245
|
this.drawScoreboard();
|
|
16253
16246
|
this.drawRainbow();
|
|
@@ -16262,7 +16255,7 @@
|
|
|
16262
16255
|
* @private
|
|
16263
16256
|
*/
|
|
16264
16257
|
|
|
16265
|
-
NyanCat.prototype.drawScoreboard = function() {
|
|
16258
|
+
NyanCat.prototype.drawScoreboard = function () {
|
|
16266
16259
|
var stats = this.stats;
|
|
16267
16260
|
|
|
16268
16261
|
function draw(type, n) {
|
|
@@ -16285,7 +16278,7 @@
|
|
|
16285
16278
|
* @private
|
|
16286
16279
|
*/
|
|
16287
16280
|
|
|
16288
|
-
NyanCat.prototype.appendRainbow = function() {
|
|
16281
|
+
NyanCat.prototype.appendRainbow = function () {
|
|
16289
16282
|
var segment = this.tick ? '_' : '-';
|
|
16290
16283
|
var rainbowified = this.rainbowify(segment);
|
|
16291
16284
|
|
|
@@ -16304,10 +16297,10 @@
|
|
|
16304
16297
|
* @private
|
|
16305
16298
|
*/
|
|
16306
16299
|
|
|
16307
|
-
NyanCat.prototype.drawRainbow = function() {
|
|
16300
|
+
NyanCat.prototype.drawRainbow = function () {
|
|
16308
16301
|
var self = this;
|
|
16309
16302
|
|
|
16310
|
-
this.trajectories.forEach(function(line) {
|
|
16303
|
+
this.trajectories.forEach(function (line) {
|
|
16311
16304
|
write('\u001b[' + self.scoreboardWidth + 'C');
|
|
16312
16305
|
write(line.join(''));
|
|
16313
16306
|
write('\n');
|
|
@@ -16321,7 +16314,7 @@
|
|
|
16321
16314
|
*
|
|
16322
16315
|
* @private
|
|
16323
16316
|
*/
|
|
16324
|
-
NyanCat.prototype.drawNyanCat = function() {
|
|
16317
|
+
NyanCat.prototype.drawNyanCat = function () {
|
|
16325
16318
|
var self = this;
|
|
16326
16319
|
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
|
16327
16320
|
var dist = '\u001b[' + startWidth + 'C';
|
|
@@ -16357,7 +16350,7 @@
|
|
|
16357
16350
|
* @return {string}
|
|
16358
16351
|
*/
|
|
16359
16352
|
|
|
16360
|
-
NyanCat.prototype.face = function() {
|
|
16353
|
+
NyanCat.prototype.face = function () {
|
|
16361
16354
|
var stats = this.stats;
|
|
16362
16355
|
if (stats.failures) {
|
|
16363
16356
|
return '( x .x)';
|
|
@@ -16376,7 +16369,7 @@
|
|
|
16376
16369
|
* @param {number} n
|
|
16377
16370
|
*/
|
|
16378
16371
|
|
|
16379
|
-
NyanCat.prototype.cursorUp = function(n) {
|
|
16372
|
+
NyanCat.prototype.cursorUp = function (n) {
|
|
16380
16373
|
write('\u001b[' + n + 'A');
|
|
16381
16374
|
};
|
|
16382
16375
|
|
|
@@ -16387,7 +16380,7 @@
|
|
|
16387
16380
|
* @param {number} n
|
|
16388
16381
|
*/
|
|
16389
16382
|
|
|
16390
|
-
NyanCat.prototype.cursorDown = function(n) {
|
|
16383
|
+
NyanCat.prototype.cursorDown = function (n) {
|
|
16391
16384
|
write('\u001b[' + n + 'B');
|
|
16392
16385
|
};
|
|
16393
16386
|
|
|
@@ -16397,7 +16390,7 @@
|
|
|
16397
16390
|
* @private
|
|
16398
16391
|
* @return {Array}
|
|
16399
16392
|
*/
|
|
16400
|
-
NyanCat.prototype.generateColors = function() {
|
|
16393
|
+
NyanCat.prototype.generateColors = function () {
|
|
16401
16394
|
var colors = [];
|
|
16402
16395
|
|
|
16403
16396
|
for (var i = 0; i < 6 * 7; i++) {
|
|
@@ -16419,7 +16412,7 @@
|
|
|
16419
16412
|
* @param {string} str
|
|
16420
16413
|
* @return {string}
|
|
16421
16414
|
*/
|
|
16422
|
-
NyanCat.prototype.rainbowify = function(str) {
|
|
16415
|
+
NyanCat.prototype.rainbowify = function (str) {
|
|
16423
16416
|
if (!base.useColors) {
|
|
16424
16417
|
return str;
|
|
16425
16418
|
}
|
|
@@ -16511,19 +16504,19 @@
|
|
|
16511
16504
|
// fall back to the default suite name
|
|
16512
16505
|
suiteName = suiteName || DEFAULT_SUITE_NAME;
|
|
16513
16506
|
|
|
16514
|
-
runner.on(EVENT_TEST_PENDING, function(test) {
|
|
16507
|
+
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
16515
16508
|
tests.push(test);
|
|
16516
16509
|
});
|
|
16517
16510
|
|
|
16518
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
16511
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16519
16512
|
tests.push(test);
|
|
16520
16513
|
});
|
|
16521
16514
|
|
|
16522
|
-
runner.on(EVENT_TEST_FAIL, function(test) {
|
|
16515
|
+
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
16523
16516
|
tests.push(test);
|
|
16524
16517
|
});
|
|
16525
16518
|
|
|
16526
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16519
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16527
16520
|
self.write(
|
|
16528
16521
|
tag(
|
|
16529
16522
|
'testsuite',
|
|
@@ -16540,7 +16533,7 @@
|
|
|
16540
16533
|
)
|
|
16541
16534
|
);
|
|
16542
16535
|
|
|
16543
|
-
tests.forEach(function(t) {
|
|
16536
|
+
tests.forEach(function (t) {
|
|
16544
16537
|
self.test(t);
|
|
16545
16538
|
});
|
|
16546
16539
|
|
|
@@ -16559,9 +16552,9 @@
|
|
|
16559
16552
|
* @param failures
|
|
16560
16553
|
* @param {Function} fn
|
|
16561
16554
|
*/
|
|
16562
|
-
XUnit.prototype.done = function(failures, fn) {
|
|
16555
|
+
XUnit.prototype.done = function (failures, fn) {
|
|
16563
16556
|
if (this.fileStream) {
|
|
16564
|
-
this.fileStream.end(function() {
|
|
16557
|
+
this.fileStream.end(function () {
|
|
16565
16558
|
fn(failures);
|
|
16566
16559
|
});
|
|
16567
16560
|
} else {
|
|
@@ -16574,7 +16567,7 @@
|
|
|
16574
16567
|
*
|
|
16575
16568
|
* @param {string} line
|
|
16576
16569
|
*/
|
|
16577
|
-
XUnit.prototype.write = function(line) {
|
|
16570
|
+
XUnit.prototype.write = function (line) {
|
|
16578
16571
|
if (this.fileStream) {
|
|
16579
16572
|
this.fileStream.write(line + '\n');
|
|
16580
16573
|
} else if (typeof process$1 === 'object' && process$1.stdout) {
|
|
@@ -16589,7 +16582,7 @@
|
|
|
16589
16582
|
*
|
|
16590
16583
|
* @param {Test} test
|
|
16591
16584
|
*/
|
|
16592
|
-
XUnit.prototype.test = function(test) {
|
|
16585
|
+
XUnit.prototype.test = function (test) {
|
|
16593
16586
|
base.useColors = false;
|
|
16594
16587
|
|
|
16595
16588
|
var attrs = {
|
|
@@ -16707,7 +16700,7 @@
|
|
|
16707
16700
|
var key = SUITE_PREFIX + suite.title;
|
|
16708
16701
|
|
|
16709
16702
|
obj = obj[key] = obj[key] || {suite: suite};
|
|
16710
|
-
suite.suites.forEach(function(suite) {
|
|
16703
|
+
suite.suites.forEach(function (suite) {
|
|
16711
16704
|
mapTOC(suite, obj);
|
|
16712
16705
|
});
|
|
16713
16706
|
|
|
@@ -16739,18 +16732,18 @@
|
|
|
16739
16732
|
|
|
16740
16733
|
generateTOC(runner.suite);
|
|
16741
16734
|
|
|
16742
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
16735
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
16743
16736
|
++level;
|
|
16744
16737
|
var slug = utils.slug(suite.fullTitle());
|
|
16745
16738
|
buf += '<a name="' + slug + '"></a>' + '\n';
|
|
16746
16739
|
buf += title(suite.title) + '\n';
|
|
16747
16740
|
});
|
|
16748
16741
|
|
|
16749
|
-
runner.on(EVENT_SUITE_END, function() {
|
|
16742
|
+
runner.on(EVENT_SUITE_END, function () {
|
|
16750
16743
|
--level;
|
|
16751
16744
|
});
|
|
16752
16745
|
|
|
16753
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
16746
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16754
16747
|
var code = utils.clean(test.body);
|
|
16755
16748
|
buf += test.title + '.\n';
|
|
16756
16749
|
buf += '\n```js\n';
|
|
@@ -16758,7 +16751,7 @@
|
|
|
16758
16751
|
buf += '```\n\n';
|
|
16759
16752
|
});
|
|
16760
16753
|
|
|
16761
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16754
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16762
16755
|
process$1.stdout.write('# TOC\n');
|
|
16763
16756
|
process$1.stdout.write(generateTOC(runner.suite));
|
|
16764
16757
|
process$1.stdout.write(buf);
|
|
@@ -16827,13 +16820,13 @@
|
|
|
16827
16820
|
options.verbose = reporterOptions.verbose || false;
|
|
16828
16821
|
|
|
16829
16822
|
// tests started
|
|
16830
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16823
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16831
16824
|
process$1.stdout.write('\n');
|
|
16832
16825
|
cursor.hide();
|
|
16833
16826
|
});
|
|
16834
16827
|
|
|
16835
16828
|
// tests complete
|
|
16836
|
-
runner.on(EVENT_TEST_END, function() {
|
|
16829
|
+
runner.on(EVENT_TEST_END, function () {
|
|
16837
16830
|
complete++;
|
|
16838
16831
|
|
|
16839
16832
|
var percent = complete / total;
|
|
@@ -16859,7 +16852,7 @@
|
|
|
16859
16852
|
|
|
16860
16853
|
// tests are complete, output some stats
|
|
16861
16854
|
// and the failures if any
|
|
16862
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16855
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16863
16856
|
cursor.show();
|
|
16864
16857
|
process$1.stdout.write('\n');
|
|
16865
16858
|
self.epilogue();
|
|
@@ -16944,12 +16937,12 @@
|
|
|
16944
16937
|
return ' ' + color('runway', buf);
|
|
16945
16938
|
}
|
|
16946
16939
|
|
|
16947
|
-
runner.on(EVENT_RUN_BEGIN, function() {
|
|
16940
|
+
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16948
16941
|
stream.write('\n\n\n ');
|
|
16949
16942
|
cursor.hide();
|
|
16950
16943
|
});
|
|
16951
16944
|
|
|
16952
|
-
runner.on(EVENT_TEST_END, function(test) {
|
|
16945
|
+
runner.on(EVENT_TEST_END, function (test) {
|
|
16953
16946
|
// check if the plane crashed
|
|
16954
16947
|
var col = crashed === -1 ? ((width * ++n) / ++total) | 0 : crashed;
|
|
16955
16948
|
// show the crash
|
|
@@ -16969,16 +16962,16 @@
|
|
|
16969
16962
|
stream.write('\u001b[0m');
|
|
16970
16963
|
});
|
|
16971
16964
|
|
|
16972
|
-
runner.once(EVENT_RUN_END, function() {
|
|
16965
|
+
runner.once(EVENT_RUN_END, function () {
|
|
16973
16966
|
cursor.show();
|
|
16974
16967
|
process$1.stdout.write('\n');
|
|
16975
16968
|
self.epilogue();
|
|
16976
16969
|
});
|
|
16977
16970
|
|
|
16978
16971
|
// if cursor is hidden when we ctrl-C, then it will remain hidden unless...
|
|
16979
|
-
process$1.once('SIGINT', function() {
|
|
16972
|
+
process$1.once('SIGINT', function () {
|
|
16980
16973
|
cursor.show();
|
|
16981
|
-
nextTick$1(function() {
|
|
16974
|
+
nextTick$1(function () {
|
|
16982
16975
|
process$1.kill(process$1.pid, 'SIGINT');
|
|
16983
16976
|
});
|
|
16984
16977
|
});
|
|
@@ -17029,22 +17022,22 @@
|
|
|
17029
17022
|
var self = this;
|
|
17030
17023
|
var total = runner.total;
|
|
17031
17024
|
|
|
17032
|
-
runner.once(EVENT_RUN_BEGIN, function() {
|
|
17025
|
+
runner.once(EVENT_RUN_BEGIN, function () {
|
|
17033
17026
|
writeEvent(['start', {total: total}]);
|
|
17034
17027
|
});
|
|
17035
17028
|
|
|
17036
|
-
runner.on(EVENT_TEST_PASS, function(test) {
|
|
17029
|
+
runner.on(EVENT_TEST_PASS, function (test) {
|
|
17037
17030
|
writeEvent(['pass', clean(test)]);
|
|
17038
17031
|
});
|
|
17039
17032
|
|
|
17040
|
-
runner.on(EVENT_TEST_FAIL, function(test, err) {
|
|
17033
|
+
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
17041
17034
|
test = clean(test);
|
|
17042
17035
|
test.err = err.message;
|
|
17043
17036
|
test.stack = err.stack || null;
|
|
17044
17037
|
writeEvent(['fail', test]);
|
|
17045
17038
|
});
|
|
17046
17039
|
|
|
17047
|
-
runner.once(EVENT_RUN_END, function() {
|
|
17040
|
+
runner.once(EVENT_RUN_END, function () {
|
|
17048
17041
|
writeEvent(['end', self.stats]);
|
|
17049
17042
|
});
|
|
17050
17043
|
}
|
|
@@ -17108,7 +17101,7 @@
|
|
|
17108
17101
|
});
|
|
17109
17102
|
|
|
17110
17103
|
var name = "mocha";
|
|
17111
|
-
var version = "9.1.
|
|
17104
|
+
var version = "9.1.4";
|
|
17112
17105
|
var homepage = "https://mochajs.org/";
|
|
17113
17106
|
var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
|
|
17114
17107
|
var _package = {
|
|
@@ -17152,7 +17145,7 @@
|
|
|
17152
17145
|
* @see {@link Mocha#isGrowlCapable}
|
|
17153
17146
|
* @return {boolean} whether browser notification support exists
|
|
17154
17147
|
*/
|
|
17155
|
-
var isCapable = function() {
|
|
17148
|
+
var isCapable = function () {
|
|
17156
17149
|
var hasNotificationSupport = 'Notification' in window;
|
|
17157
17150
|
var hasPromiseSupport = typeof Promise === 'function';
|
|
17158
17151
|
return isBrowser() && hasNotificationSupport && hasPromiseSupport;
|
|
@@ -17168,17 +17161,17 @@
|
|
|
17168
17161
|
* @see {@link Mocha#_growl}
|
|
17169
17162
|
* @param {Runner} runner - Runner instance.
|
|
17170
17163
|
*/
|
|
17171
|
-
var notify = function(runner) {
|
|
17164
|
+
var notify = function (runner) {
|
|
17172
17165
|
var promise = isPermitted();
|
|
17173
17166
|
|
|
17174
17167
|
/**
|
|
17175
17168
|
* Attempt notification.
|
|
17176
17169
|
*/
|
|
17177
|
-
var sendNotification = function() {
|
|
17170
|
+
var sendNotification = function () {
|
|
17178
17171
|
// If user hasn't responded yet... "No notification for you!" (Seinfeld)
|
|
17179
17172
|
Promise.race([promise, Promise.resolve(undefined)])
|
|
17180
17173
|
.then(canNotify)
|
|
17181
|
-
.then(function() {
|
|
17174
|
+
.then(function () {
|
|
17182
17175
|
display(runner);
|
|
17183
17176
|
})
|
|
17184
17177
|
.catch(notPermitted);
|
|
@@ -17206,7 +17199,7 @@
|
|
|
17206
17199
|
return Promise.resolve(false);
|
|
17207
17200
|
},
|
|
17208
17201
|
default: function ask() {
|
|
17209
|
-
return Notification.requestPermission().then(function(permission) {
|
|
17202
|
+
return Notification.requestPermission().then(function (permission) {
|
|
17210
17203
|
return permission === 'granted';
|
|
17211
17204
|
});
|
|
17212
17205
|
}
|
|
@@ -17393,25 +17386,25 @@
|
|
|
17393
17386
|
|
|
17394
17387
|
runner.stats = stats;
|
|
17395
17388
|
|
|
17396
|
-
runner.once(EVENT_RUN_BEGIN, function() {
|
|
17389
|
+
runner.once(EVENT_RUN_BEGIN, function () {
|
|
17397
17390
|
stats.start = new Date$2();
|
|
17398
17391
|
});
|
|
17399
|
-
runner.on(EVENT_SUITE_BEGIN, function(suite) {
|
|
17392
|
+
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
17400
17393
|
suite.root || stats.suites++;
|
|
17401
17394
|
});
|
|
17402
|
-
runner.on(EVENT_TEST_PASS, function() {
|
|
17395
|
+
runner.on(EVENT_TEST_PASS, function () {
|
|
17403
17396
|
stats.passes++;
|
|
17404
17397
|
});
|
|
17405
|
-
runner.on(EVENT_TEST_FAIL, function() {
|
|
17398
|
+
runner.on(EVENT_TEST_FAIL, function () {
|
|
17406
17399
|
stats.failures++;
|
|
17407
17400
|
});
|
|
17408
|
-
runner.on(EVENT_TEST_PENDING, function() {
|
|
17401
|
+
runner.on(EVENT_TEST_PENDING, function () {
|
|
17409
17402
|
stats.pending++;
|
|
17410
17403
|
});
|
|
17411
|
-
runner.on(EVENT_TEST_END, function() {
|
|
17404
|
+
runner.on(EVENT_TEST_END, function () {
|
|
17412
17405
|
stats.tests++;
|
|
17413
17406
|
});
|
|
17414
|
-
runner.once(EVENT_RUN_END, function() {
|
|
17407
|
+
runner.once(EVENT_RUN_END, function () {
|
|
17415
17408
|
stats.end = new Date$2();
|
|
17416
17409
|
stats.duration = stats.end - stats.start;
|
|
17417
17410
|
});
|
|
@@ -17458,7 +17451,7 @@
|
|
|
17458
17451
|
/**
|
|
17459
17452
|
* Resets the state initially or for a next run.
|
|
17460
17453
|
*/
|
|
17461
|
-
Test.prototype.reset = function() {
|
|
17454
|
+
Test.prototype.reset = function () {
|
|
17462
17455
|
runnable.prototype.reset.call(this);
|
|
17463
17456
|
this.pending = !this.fn;
|
|
17464
17457
|
delete this.state;
|
|
@@ -17469,7 +17462,7 @@
|
|
|
17469
17462
|
*
|
|
17470
17463
|
* @private
|
|
17471
17464
|
*/
|
|
17472
|
-
Test.prototype.retriedTest = function(n) {
|
|
17465
|
+
Test.prototype.retriedTest = function (n) {
|
|
17473
17466
|
if (!arguments.length) {
|
|
17474
17467
|
return this._retriedTest;
|
|
17475
17468
|
}
|
|
@@ -17481,11 +17474,11 @@
|
|
|
17481
17474
|
*
|
|
17482
17475
|
* @private
|
|
17483
17476
|
*/
|
|
17484
|
-
Test.prototype.markOnly = function() {
|
|
17477
|
+
Test.prototype.markOnly = function () {
|
|
17485
17478
|
this.parent.appendOnlyTest(this);
|
|
17486
17479
|
};
|
|
17487
17480
|
|
|
17488
|
-
Test.prototype.clone = function() {
|
|
17481
|
+
Test.prototype.clone = function () {
|
|
17489
17482
|
var test = new Test(this.title, this.fn);
|
|
17490
17483
|
test.timeout(this.timeout());
|
|
17491
17484
|
test.slow(this.slow());
|
|
@@ -17548,7 +17541,7 @@
|
|
|
17548
17541
|
* @param {Mocha} mocha
|
|
17549
17542
|
* @return {Object} An object containing common functions.
|
|
17550
17543
|
*/
|
|
17551
|
-
var common = function(suites, context, mocha) {
|
|
17544
|
+
var common = function (suites, context, mocha) {
|
|
17552
17545
|
/**
|
|
17553
17546
|
* Check if the suite should be tested.
|
|
17554
17547
|
*
|
|
@@ -17585,7 +17578,7 @@
|
|
|
17585
17578
|
* @param {string} name
|
|
17586
17579
|
* @param {Function} fn
|
|
17587
17580
|
*/
|
|
17588
|
-
before: function(name, fn) {
|
|
17581
|
+
before: function (name, fn) {
|
|
17589
17582
|
suites[0].beforeAll(name, fn);
|
|
17590
17583
|
},
|
|
17591
17584
|
|
|
@@ -17595,7 +17588,7 @@
|
|
|
17595
17588
|
* @param {string} name
|
|
17596
17589
|
* @param {Function} fn
|
|
17597
17590
|
*/
|
|
17598
|
-
after: function(name, fn) {
|
|
17591
|
+
after: function (name, fn) {
|
|
17599
17592
|
suites[0].afterAll(name, fn);
|
|
17600
17593
|
},
|
|
17601
17594
|
|
|
@@ -17605,7 +17598,7 @@
|
|
|
17605
17598
|
* @param {string} name
|
|
17606
17599
|
* @param {Function} fn
|
|
17607
17600
|
*/
|
|
17608
|
-
beforeEach: function(name, fn) {
|
|
17601
|
+
beforeEach: function (name, fn) {
|
|
17609
17602
|
suites[0].beforeEach(name, fn);
|
|
17610
17603
|
},
|
|
17611
17604
|
|
|
@@ -17615,7 +17608,7 @@
|
|
|
17615
17608
|
* @param {string} name
|
|
17616
17609
|
* @param {Function} fn
|
|
17617
17610
|
*/
|
|
17618
|
-
afterEach: function(name, fn) {
|
|
17611
|
+
afterEach: function (name, fn) {
|
|
17619
17612
|
suites[0].afterEach(name, fn);
|
|
17620
17613
|
},
|
|
17621
17614
|
|
|
@@ -17701,7 +17694,7 @@
|
|
|
17701
17694
|
* @param {Function} test
|
|
17702
17695
|
* @returns {*}
|
|
17703
17696
|
*/
|
|
17704
|
-
only: function(mocha, test) {
|
|
17697
|
+
only: function (mocha, test) {
|
|
17705
17698
|
if (mocha.options.forbidOnly) {
|
|
17706
17699
|
throw createForbiddenExclusivityError(mocha);
|
|
17707
17700
|
}
|
|
@@ -17714,15 +17707,15 @@
|
|
|
17714
17707
|
*
|
|
17715
17708
|
* @param {string} title
|
|
17716
17709
|
*/
|
|
17717
|
-
skip: function(title) {
|
|
17710
|
+
skip: function (title) {
|
|
17718
17711
|
context.test(title);
|
|
17719
17712
|
}
|
|
17720
17713
|
}
|
|
17721
17714
|
};
|
|
17722
17715
|
};
|
|
17723
17716
|
|
|
17724
|
-
var EVENT_FILE_PRE_REQUIRE$2 =
|
|
17725
|
-
.EVENT_FILE_PRE_REQUIRE;
|
|
17717
|
+
var EVENT_FILE_PRE_REQUIRE$2 =
|
|
17718
|
+
suite.constants.EVENT_FILE_PRE_REQUIRE;
|
|
17726
17719
|
|
|
17727
17720
|
/**
|
|
17728
17721
|
* BDD-style interface:
|
|
@@ -17744,7 +17737,7 @@
|
|
|
17744
17737
|
var bdd$1 = function bddInterface(suite) {
|
|
17745
17738
|
var suites = [suite];
|
|
17746
17739
|
|
|
17747
|
-
suite.on(EVENT_FILE_PRE_REQUIRE$2, function(context, file, mocha) {
|
|
17740
|
+
suite.on(EVENT_FILE_PRE_REQUIRE$2, function (context, file, mocha) {
|
|
17748
17741
|
var common$1 = common(suites, context, mocha);
|
|
17749
17742
|
|
|
17750
17743
|
context.before = common$1.before;
|
|
@@ -17758,7 +17751,7 @@
|
|
|
17758
17751
|
* and/or tests.
|
|
17759
17752
|
*/
|
|
17760
17753
|
|
|
17761
|
-
context.describe = context.context = function(title, fn) {
|
|
17754
|
+
context.describe = context.context = function (title, fn) {
|
|
17762
17755
|
return common$1.suite.create({
|
|
17763
17756
|
title: title,
|
|
17764
17757
|
file: file,
|
|
@@ -17770,22 +17763,22 @@
|
|
|
17770
17763
|
* Pending describe.
|
|
17771
17764
|
*/
|
|
17772
17765
|
|
|
17773
|
-
context.xdescribe =
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17766
|
+
context.xdescribe =
|
|
17767
|
+
context.xcontext =
|
|
17768
|
+
context.describe.skip =
|
|
17769
|
+
function (title, fn) {
|
|
17770
|
+
return common$1.suite.skip({
|
|
17771
|
+
title: title,
|
|
17772
|
+
file: file,
|
|
17773
|
+
fn: fn
|
|
17774
|
+
});
|
|
17775
|
+
};
|
|
17783
17776
|
|
|
17784
17777
|
/**
|
|
17785
17778
|
* Exclusive suite.
|
|
17786
17779
|
*/
|
|
17787
17780
|
|
|
17788
|
-
context.describe.only = function(title, fn) {
|
|
17781
|
+
context.describe.only = function (title, fn) {
|
|
17789
17782
|
return common$1.suite.only({
|
|
17790
17783
|
title: title,
|
|
17791
17784
|
file: file,
|
|
@@ -17799,7 +17792,7 @@
|
|
|
17799
17792
|
* acting as a thunk.
|
|
17800
17793
|
*/
|
|
17801
17794
|
|
|
17802
|
-
context.it = context.specify = function(title, fn) {
|
|
17795
|
+
context.it = context.specify = function (title, fn) {
|
|
17803
17796
|
var suite = suites[0];
|
|
17804
17797
|
if (suite.isPending()) {
|
|
17805
17798
|
fn = null;
|
|
@@ -17814,7 +17807,7 @@
|
|
|
17814
17807
|
* Exclusive test-case.
|
|
17815
17808
|
*/
|
|
17816
17809
|
|
|
17817
|
-
context.it.only = function(title, fn) {
|
|
17810
|
+
context.it.only = function (title, fn) {
|
|
17818
17811
|
return common$1.test.only(mocha, context.it(title, fn));
|
|
17819
17812
|
};
|
|
17820
17813
|
|
|
@@ -17822,17 +17815,20 @@
|
|
|
17822
17815
|
* Pending test case.
|
|
17823
17816
|
*/
|
|
17824
17817
|
|
|
17825
|
-
context.xit =
|
|
17826
|
-
|
|
17827
|
-
|
|
17818
|
+
context.xit =
|
|
17819
|
+
context.xspecify =
|
|
17820
|
+
context.it.skip =
|
|
17821
|
+
function (title) {
|
|
17822
|
+
return context.it(title);
|
|
17823
|
+
};
|
|
17828
17824
|
});
|
|
17829
17825
|
};
|
|
17830
17826
|
|
|
17831
17827
|
var description$3 = 'BDD or RSpec style [default]';
|
|
17832
17828
|
bdd$1.description = description$3;
|
|
17833
17829
|
|
|
17834
|
-
var EVENT_FILE_PRE_REQUIRE$1 =
|
|
17835
|
-
.EVENT_FILE_PRE_REQUIRE;
|
|
17830
|
+
var EVENT_FILE_PRE_REQUIRE$1 =
|
|
17831
|
+
suite.constants.EVENT_FILE_PRE_REQUIRE;
|
|
17836
17832
|
|
|
17837
17833
|
/**
|
|
17838
17834
|
* TDD-style interface:
|
|
@@ -17859,10 +17855,10 @@
|
|
|
17859
17855
|
*
|
|
17860
17856
|
* @param {Suite} suite Root suite.
|
|
17861
17857
|
*/
|
|
17862
|
-
var tdd$1 = function(suite) {
|
|
17858
|
+
var tdd$1 = function (suite) {
|
|
17863
17859
|
var suites = [suite];
|
|
17864
17860
|
|
|
17865
|
-
suite.on(EVENT_FILE_PRE_REQUIRE$1, function(context, file, mocha) {
|
|
17861
|
+
suite.on(EVENT_FILE_PRE_REQUIRE$1, function (context, file, mocha) {
|
|
17866
17862
|
var common$1 = common(suites, context, mocha);
|
|
17867
17863
|
|
|
17868
17864
|
context.setup = common$1.beforeEach;
|
|
@@ -17875,7 +17871,7 @@
|
|
|
17875
17871
|
* Describe a "suite" with the given `title` and callback `fn` containing
|
|
17876
17872
|
* nested suites and/or tests.
|
|
17877
17873
|
*/
|
|
17878
|
-
context.suite = function(title, fn) {
|
|
17874
|
+
context.suite = function (title, fn) {
|
|
17879
17875
|
return common$1.suite.create({
|
|
17880
17876
|
title: title,
|
|
17881
17877
|
file: file,
|
|
@@ -17886,7 +17882,7 @@
|
|
|
17886
17882
|
/**
|
|
17887
17883
|
* Pending suite.
|
|
17888
17884
|
*/
|
|
17889
|
-
context.suite.skip = function(title, fn) {
|
|
17885
|
+
context.suite.skip = function (title, fn) {
|
|
17890
17886
|
return common$1.suite.skip({
|
|
17891
17887
|
title: title,
|
|
17892
17888
|
file: file,
|
|
@@ -17897,7 +17893,7 @@
|
|
|
17897
17893
|
/**
|
|
17898
17894
|
* Exclusive test-case.
|
|
17899
17895
|
*/
|
|
17900
|
-
context.suite.only = function(title, fn) {
|
|
17896
|
+
context.suite.only = function (title, fn) {
|
|
17901
17897
|
return common$1.suite.only({
|
|
17902
17898
|
title: title,
|
|
17903
17899
|
file: file,
|
|
@@ -17909,7 +17905,7 @@
|
|
|
17909
17905
|
* Describe a specification or test-case with the given `title` and
|
|
17910
17906
|
* callback `fn` acting as a thunk.
|
|
17911
17907
|
*/
|
|
17912
|
-
context.test = function(title, fn) {
|
|
17908
|
+
context.test = function (title, fn) {
|
|
17913
17909
|
var suite = suites[0];
|
|
17914
17910
|
if (suite.isPending()) {
|
|
17915
17911
|
fn = null;
|
|
@@ -17924,7 +17920,7 @@
|
|
|
17924
17920
|
* Exclusive test-case.
|
|
17925
17921
|
*/
|
|
17926
17922
|
|
|
17927
|
-
context.test.only = function(title, fn) {
|
|
17923
|
+
context.test.only = function (title, fn) {
|
|
17928
17924
|
return common$1.test.only(mocha, context.test(title, fn));
|
|
17929
17925
|
};
|
|
17930
17926
|
|
|
@@ -17936,8 +17932,8 @@
|
|
|
17936
17932
|
'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
|
|
17937
17933
|
tdd$1.description = description$2;
|
|
17938
17934
|
|
|
17939
|
-
var EVENT_FILE_PRE_REQUIRE =
|
|
17940
|
-
.EVENT_FILE_PRE_REQUIRE;
|
|
17935
|
+
var EVENT_FILE_PRE_REQUIRE =
|
|
17936
|
+
suite.constants.EVENT_FILE_PRE_REQUIRE;
|
|
17941
17937
|
|
|
17942
17938
|
/**
|
|
17943
17939
|
* QUnit-style interface:
|
|
@@ -17967,7 +17963,7 @@
|
|
|
17967
17963
|
var qunit$1 = function qUnitInterface(suite) {
|
|
17968
17964
|
var suites = [suite];
|
|
17969
17965
|
|
|
17970
|
-
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
17966
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function (context, file, mocha) {
|
|
17971
17967
|
var common$1 = common(suites, context, mocha);
|
|
17972
17968
|
|
|
17973
17969
|
context.before = common$1.before;
|
|
@@ -17979,7 +17975,7 @@
|
|
|
17979
17975
|
* Describe a "suite" with the given `title`.
|
|
17980
17976
|
*/
|
|
17981
17977
|
|
|
17982
|
-
context.suite = function(title) {
|
|
17978
|
+
context.suite = function (title) {
|
|
17983
17979
|
if (suites.length > 1) {
|
|
17984
17980
|
suites.shift();
|
|
17985
17981
|
}
|
|
@@ -17994,7 +17990,7 @@
|
|
|
17994
17990
|
* Exclusive Suite.
|
|
17995
17991
|
*/
|
|
17996
17992
|
|
|
17997
|
-
context.suite.only = function(title) {
|
|
17993
|
+
context.suite.only = function (title) {
|
|
17998
17994
|
if (suites.length > 1) {
|
|
17999
17995
|
suites.shift();
|
|
18000
17996
|
}
|
|
@@ -18011,7 +18007,7 @@
|
|
|
18011
18007
|
* acting as a thunk.
|
|
18012
18008
|
*/
|
|
18013
18009
|
|
|
18014
|
-
context.test = function(title, fn) {
|
|
18010
|
+
context.test = function (title, fn) {
|
|
18015
18011
|
var test$1 = new test(title, fn);
|
|
18016
18012
|
test$1.file = file;
|
|
18017
18013
|
suites[0].addTest(test$1);
|
|
@@ -18022,7 +18018,7 @@
|
|
|
18022
18018
|
* Exclusive test-case.
|
|
18023
18019
|
*/
|
|
18024
18020
|
|
|
18025
|
-
context.test.only = function(title, fn) {
|
|
18021
|
+
context.test.only = function (title, fn) {
|
|
18026
18022
|
return common$1.test.only(mocha, context.test(title, fn));
|
|
18027
18023
|
};
|
|
18028
18024
|
|
|
@@ -18050,7 +18046,7 @@
|
|
|
18050
18046
|
*
|
|
18051
18047
|
* @param {Suite} suite Root suite.
|
|
18052
18048
|
*/
|
|
18053
|
-
var exports$2 = function(suite$1) {
|
|
18049
|
+
var exports$2 = function (suite$1) {
|
|
18054
18050
|
var suites = [suite$1];
|
|
18055
18051
|
|
|
18056
18052
|
suite$1.on(suite.constants.EVENT_FILE_REQUIRE, visit);
|
|
@@ -18126,7 +18122,7 @@
|
|
|
18126
18122
|
* @param {Runnable} runnable
|
|
18127
18123
|
* @return {Context} context
|
|
18128
18124
|
*/
|
|
18129
|
-
Context.prototype.runnable = function(runnable) {
|
|
18125
|
+
Context.prototype.runnable = function (runnable) {
|
|
18130
18126
|
if (!arguments.length) {
|
|
18131
18127
|
return this._runnable;
|
|
18132
18128
|
}
|
|
@@ -18141,7 +18137,7 @@
|
|
|
18141
18137
|
* @param {number} ms
|
|
18142
18138
|
* @return {Context} self
|
|
18143
18139
|
*/
|
|
18144
|
-
Context.prototype.timeout = function(ms) {
|
|
18140
|
+
Context.prototype.timeout = function (ms) {
|
|
18145
18141
|
if (!arguments.length) {
|
|
18146
18142
|
return this.runnable().timeout();
|
|
18147
18143
|
}
|
|
@@ -18156,7 +18152,7 @@
|
|
|
18156
18152
|
* @param {number} ms
|
|
18157
18153
|
* @return {Context} self
|
|
18158
18154
|
*/
|
|
18159
|
-
Context.prototype.slow = function(ms) {
|
|
18155
|
+
Context.prototype.slow = function (ms) {
|
|
18160
18156
|
if (!arguments.length) {
|
|
18161
18157
|
return this.runnable().slow();
|
|
18162
18158
|
}
|
|
@@ -18170,7 +18166,7 @@
|
|
|
18170
18166
|
* @private
|
|
18171
18167
|
* @throws Pending
|
|
18172
18168
|
*/
|
|
18173
|
-
Context.prototype.skip = function() {
|
|
18169
|
+
Context.prototype.skip = function () {
|
|
18174
18170
|
this.runnable().skip();
|
|
18175
18171
|
};
|
|
18176
18172
|
|
|
@@ -18181,7 +18177,7 @@
|
|
|
18181
18177
|
* @param {number} n
|
|
18182
18178
|
* @return {Context} self
|
|
18183
18179
|
*/
|
|
18184
|
-
Context.prototype.retries = function(n) {
|
|
18180
|
+
Context.prototype.retries = function (n) {
|
|
18185
18181
|
if (!arguments.length) {
|
|
18186
18182
|
return this.runnable().retries();
|
|
18187
18183
|
}
|
|
@@ -18216,11 +18212,8 @@
|
|
|
18216
18212
|
createMochaInstanceAlreadyRunningError,
|
|
18217
18213
|
createUnsupportedError
|
|
18218
18214
|
} = errors;
|
|
18219
|
-
const {
|
|
18220
|
-
|
|
18221
|
-
EVENT_FILE_POST_REQUIRE,
|
|
18222
|
-
EVENT_FILE_REQUIRE
|
|
18223
|
-
} = suite.constants;
|
|
18215
|
+
const {EVENT_FILE_PRE_REQUIRE, EVENT_FILE_POST_REQUIRE, EVENT_FILE_REQUIRE} =
|
|
18216
|
+
suite.constants;
|
|
18224
18217
|
var debug = browser('mocha:mocha');
|
|
18225
18218
|
|
|
18226
18219
|
exports = module.exports = Mocha;
|
|
@@ -18287,46 +18280,46 @@
|
|
|
18287
18280
|
exports.Test = test;
|
|
18288
18281
|
|
|
18289
18282
|
let currentContext;
|
|
18290
|
-
exports.afterEach = function(...args) {
|
|
18283
|
+
exports.afterEach = function (...args) {
|
|
18291
18284
|
return (currentContext.afterEach || currentContext.teardown).apply(
|
|
18292
18285
|
this,
|
|
18293
18286
|
args
|
|
18294
18287
|
);
|
|
18295
18288
|
};
|
|
18296
|
-
exports.after = function(...args) {
|
|
18289
|
+
exports.after = function (...args) {
|
|
18297
18290
|
return (currentContext.after || currentContext.suiteTeardown).apply(
|
|
18298
18291
|
this,
|
|
18299
18292
|
args
|
|
18300
18293
|
);
|
|
18301
18294
|
};
|
|
18302
|
-
exports.beforeEach = function(...args) {
|
|
18295
|
+
exports.beforeEach = function (...args) {
|
|
18303
18296
|
return (currentContext.beforeEach || currentContext.setup).apply(this, args);
|
|
18304
18297
|
};
|
|
18305
|
-
exports.before = function(...args) {
|
|
18298
|
+
exports.before = function (...args) {
|
|
18306
18299
|
return (currentContext.before || currentContext.suiteSetup).apply(this, args);
|
|
18307
18300
|
};
|
|
18308
|
-
exports.describe = function(...args) {
|
|
18301
|
+
exports.describe = function (...args) {
|
|
18309
18302
|
return (currentContext.describe || currentContext.suite).apply(this, args);
|
|
18310
18303
|
};
|
|
18311
|
-
exports.describe.only = function(...args) {
|
|
18304
|
+
exports.describe.only = function (...args) {
|
|
18312
18305
|
return (currentContext.describe || currentContext.suite).only.apply(
|
|
18313
18306
|
this,
|
|
18314
18307
|
args
|
|
18315
18308
|
);
|
|
18316
18309
|
};
|
|
18317
|
-
exports.describe.skip = function(...args) {
|
|
18310
|
+
exports.describe.skip = function (...args) {
|
|
18318
18311
|
return (currentContext.describe || currentContext.suite).skip.apply(
|
|
18319
18312
|
this,
|
|
18320
18313
|
args
|
|
18321
18314
|
);
|
|
18322
18315
|
};
|
|
18323
|
-
exports.it = function(...args) {
|
|
18316
|
+
exports.it = function (...args) {
|
|
18324
18317
|
return (currentContext.it || currentContext.test).apply(this, args);
|
|
18325
18318
|
};
|
|
18326
|
-
exports.it.only = function(...args) {
|
|
18319
|
+
exports.it.only = function (...args) {
|
|
18327
18320
|
return (currentContext.it || currentContext.test).only.apply(this, args);
|
|
18328
18321
|
};
|
|
18329
|
-
exports.it.skip = function(...args) {
|
|
18322
|
+
exports.it.skip = function (...args) {
|
|
18330
18323
|
return (currentContext.it || currentContext.test).skip.apply(this, args);
|
|
18331
18324
|
};
|
|
18332
18325
|
exports.xdescribe = exports.describe.skip;
|
|
@@ -18337,7 +18330,7 @@
|
|
|
18337
18330
|
exports.suite = exports.describe;
|
|
18338
18331
|
exports.teardown = exports.afterEach;
|
|
18339
18332
|
exports.test = exports.it;
|
|
18340
|
-
exports.run = function(...args) {
|
|
18333
|
+
exports.run = function (...args) {
|
|
18341
18334
|
return currentContext.run.apply(this, args);
|
|
18342
18335
|
};
|
|
18343
18336
|
|
|
@@ -18422,7 +18415,7 @@
|
|
|
18422
18415
|
'growl',
|
|
18423
18416
|
'inlineDiffs',
|
|
18424
18417
|
'invert'
|
|
18425
|
-
].forEach(function(opt) {
|
|
18418
|
+
].forEach(function (opt) {
|
|
18426
18419
|
if (options[opt]) {
|
|
18427
18420
|
this[opt]();
|
|
18428
18421
|
}
|
|
@@ -18480,7 +18473,7 @@
|
|
|
18480
18473
|
* @returns {Mocha} this
|
|
18481
18474
|
* @chainable
|
|
18482
18475
|
*/
|
|
18483
|
-
Mocha.prototype.bail = function(bail) {
|
|
18476
|
+
Mocha.prototype.bail = function (bail) {
|
|
18484
18477
|
this.suite.bail(bail !== false);
|
|
18485
18478
|
return this;
|
|
18486
18479
|
};
|
|
@@ -18498,7 +18491,7 @@
|
|
|
18498
18491
|
* @returns {Mocha} this
|
|
18499
18492
|
* @chainable
|
|
18500
18493
|
*/
|
|
18501
|
-
Mocha.prototype.addFile = function(file) {
|
|
18494
|
+
Mocha.prototype.addFile = function (file) {
|
|
18502
18495
|
this.files.push(file);
|
|
18503
18496
|
return this;
|
|
18504
18497
|
};
|
|
@@ -18519,7 +18512,7 @@
|
|
|
18519
18512
|
* // Use XUnit reporter and direct its output to file
|
|
18520
18513
|
* mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
|
|
18521
18514
|
*/
|
|
18522
|
-
Mocha.prototype.reporter = function(reporterName, reporterOptions) {
|
|
18515
|
+
Mocha.prototype.reporter = function (reporterName, reporterOptions) {
|
|
18523
18516
|
if (typeof reporterName === 'function') {
|
|
18524
18517
|
this._reporter = reporterName;
|
|
18525
18518
|
} else {
|
|
@@ -18575,7 +18568,7 @@
|
|
|
18575
18568
|
* @chainable
|
|
18576
18569
|
* @throws {Error} if requested interface cannot be loaded
|
|
18577
18570
|
*/
|
|
18578
|
-
Mocha.prototype.ui = function(ui) {
|
|
18571
|
+
Mocha.prototype.ui = function (ui) {
|
|
18579
18572
|
var bindInterface;
|
|
18580
18573
|
if (typeof ui === 'function') {
|
|
18581
18574
|
bindInterface = ui;
|
|
@@ -18592,7 +18585,7 @@
|
|
|
18592
18585
|
}
|
|
18593
18586
|
bindInterface(this.suite);
|
|
18594
18587
|
|
|
18595
|
-
this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
|
|
18588
|
+
this.suite.on(EVENT_FILE_PRE_REQUIRE, function (context) {
|
|
18596
18589
|
currentContext = context;
|
|
18597
18590
|
});
|
|
18598
18591
|
|
|
@@ -18614,10 +18607,10 @@
|
|
|
18614
18607
|
* @see {@link Mocha#loadFilesAsync}
|
|
18615
18608
|
* @param {Function} [fn] - Callback invoked upon completion.
|
|
18616
18609
|
*/
|
|
18617
|
-
Mocha.prototype.loadFiles = function(fn) {
|
|
18610
|
+
Mocha.prototype.loadFiles = function (fn) {
|
|
18618
18611
|
var self = this;
|
|
18619
18612
|
var suite = this.suite;
|
|
18620
|
-
this.files.forEach(function(file) {
|
|
18613
|
+
this.files.forEach(function (file) {
|
|
18621
18614
|
file = path.resolve(file);
|
|
18622
18615
|
suite.emit(EVENT_FILE_PRE_REQUIRE, commonjsGlobal, file, self);
|
|
18623
18616
|
suite.emit(EVENT_FILE_REQUIRE, commonjsRequire(), file, self);
|
|
@@ -18646,17 +18639,17 @@
|
|
|
18646
18639
|
* .then(() => mocha.run(failures => process.exitCode = failures ? 1 : 0))
|
|
18647
18640
|
* .catch(() => process.exitCode = 1);
|
|
18648
18641
|
*/
|
|
18649
|
-
Mocha.prototype.loadFilesAsync = function() {
|
|
18642
|
+
Mocha.prototype.loadFilesAsync = function () {
|
|
18650
18643
|
var self = this;
|
|
18651
18644
|
var suite = this.suite;
|
|
18652
18645
|
this.lazyLoadFiles(true);
|
|
18653
18646
|
|
|
18654
18647
|
return require$$10.loadFilesAsync(
|
|
18655
18648
|
this.files,
|
|
18656
|
-
function(file) {
|
|
18649
|
+
function (file) {
|
|
18657
18650
|
suite.emit(EVENT_FILE_PRE_REQUIRE, commonjsGlobal, file, self);
|
|
18658
18651
|
},
|
|
18659
|
-
function(file, resultModule) {
|
|
18652
|
+
function (file, resultModule) {
|
|
18660
18653
|
suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
|
|
18661
18654
|
suite.emit(EVENT_FILE_POST_REQUIRE, commonjsGlobal, file, self);
|
|
18662
18655
|
}
|
|
@@ -18671,7 +18664,7 @@
|
|
|
18671
18664
|
* @see {@link Mocha#unloadFiles}
|
|
18672
18665
|
* @param {string} file - Pathname of file to be unloaded.
|
|
18673
18666
|
*/
|
|
18674
|
-
Mocha.unloadFile = function(file) {
|
|
18667
|
+
Mocha.unloadFile = function (file) {
|
|
18675
18668
|
if (utils.isBrowser()) {
|
|
18676
18669
|
throw createUnsupportedError(
|
|
18677
18670
|
'unloadFile() is only suported in a Node.js environment'
|
|
@@ -18695,7 +18688,7 @@
|
|
|
18695
18688
|
* @returns {Mocha} this
|
|
18696
18689
|
* @chainable
|
|
18697
18690
|
*/
|
|
18698
|
-
Mocha.prototype.unloadFiles = function() {
|
|
18691
|
+
Mocha.prototype.unloadFiles = function () {
|
|
18699
18692
|
if (this._state === mochaStates.DISPOSED) {
|
|
18700
18693
|
throw createMochaInstanceAlreadyDisposedError(
|
|
18701
18694
|
'Mocha instance is already disposed, it cannot be used again.',
|
|
@@ -18704,7 +18697,7 @@
|
|
|
18704
18697
|
);
|
|
18705
18698
|
}
|
|
18706
18699
|
|
|
18707
|
-
this.files.forEach(function(file) {
|
|
18700
|
+
this.files.forEach(function (file) {
|
|
18708
18701
|
Mocha.unloadFile(file);
|
|
18709
18702
|
});
|
|
18710
18703
|
this._state = mochaStates.INIT;
|
|
@@ -18724,7 +18717,7 @@
|
|
|
18724
18717
|
* // Select tests whose full title begins with `"foo"` followed by a period
|
|
18725
18718
|
* mocha.fgrep('foo.');
|
|
18726
18719
|
*/
|
|
18727
|
-
Mocha.prototype.fgrep = function(str) {
|
|
18720
|
+
Mocha.prototype.fgrep = function (str) {
|
|
18728
18721
|
if (!str) {
|
|
18729
18722
|
return this;
|
|
18730
18723
|
}
|
|
@@ -18765,7 +18758,7 @@
|
|
|
18765
18758
|
* // Given embedded test `it('only-this-test')`...
|
|
18766
18759
|
* mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
|
|
18767
18760
|
*/
|
|
18768
|
-
Mocha.prototype.grep = function(re) {
|
|
18761
|
+
Mocha.prototype.grep = function (re) {
|
|
18769
18762
|
if (utils.isString(re)) {
|
|
18770
18763
|
// extract args if it's regex-like, i.e: [string, pattern, flag]
|
|
18771
18764
|
var arg = re.match(/^\/(.*)\/([gimy]{0,4})$|.*/);
|
|
@@ -18788,7 +18781,7 @@
|
|
|
18788
18781
|
* // Select tests whose full title does *not* contain `"match"`, ignoring case
|
|
18789
18782
|
* mocha.grep(/match/i).invert();
|
|
18790
18783
|
*/
|
|
18791
|
-
Mocha.prototype.invert = function() {
|
|
18784
|
+
Mocha.prototype.invert = function () {
|
|
18792
18785
|
this.options.invert = true;
|
|
18793
18786
|
return this;
|
|
18794
18787
|
};
|
|
@@ -18802,7 +18795,7 @@
|
|
|
18802
18795
|
* @return {Mocha} this
|
|
18803
18796
|
* @chainable
|
|
18804
18797
|
*/
|
|
18805
|
-
Mocha.prototype.checkLeaks = function(checkLeaks) {
|
|
18798
|
+
Mocha.prototype.checkLeaks = function (checkLeaks) {
|
|
18806
18799
|
this.options.checkLeaks = checkLeaks !== false;
|
|
18807
18800
|
return this;
|
|
18808
18801
|
};
|
|
@@ -18817,7 +18810,7 @@
|
|
|
18817
18810
|
* @return {Mocha} this
|
|
18818
18811
|
* @chainable
|
|
18819
18812
|
*/
|
|
18820
|
-
Mocha.prototype.cleanReferencesAfterRun = function(cleanReferencesAfterRun) {
|
|
18813
|
+
Mocha.prototype.cleanReferencesAfterRun = function (cleanReferencesAfterRun) {
|
|
18821
18814
|
this._cleanReferencesAfterRun = cleanReferencesAfterRun !== false;
|
|
18822
18815
|
return this;
|
|
18823
18816
|
};
|
|
@@ -18827,7 +18820,7 @@
|
|
|
18827
18820
|
* It also removes function references to tests functions and hooks, so variables trapped in closures can be cleaned by the garbage collector.
|
|
18828
18821
|
* @public
|
|
18829
18822
|
*/
|
|
18830
|
-
Mocha.prototype.dispose = function() {
|
|
18823
|
+
Mocha.prototype.dispose = function () {
|
|
18831
18824
|
if (this._state === mochaStates.RUNNING) {
|
|
18832
18825
|
throw createMochaInstanceAlreadyRunningError(
|
|
18833
18826
|
'Cannot dispose while the mocha instance is still running tests.'
|
|
@@ -18848,7 +18841,7 @@
|
|
|
18848
18841
|
* @return {Mocha} this
|
|
18849
18842
|
* @chainable
|
|
18850
18843
|
*/
|
|
18851
|
-
Mocha.prototype.fullTrace = function(fullTrace) {
|
|
18844
|
+
Mocha.prototype.fullTrace = function (fullTrace) {
|
|
18852
18845
|
this.options.fullTrace = fullTrace !== false;
|
|
18853
18846
|
return this;
|
|
18854
18847
|
};
|
|
@@ -18861,7 +18854,7 @@
|
|
|
18861
18854
|
* @return {Mocha} this
|
|
18862
18855
|
* @chainable
|
|
18863
18856
|
*/
|
|
18864
|
-
Mocha.prototype.growl = function() {
|
|
18857
|
+
Mocha.prototype.growl = function () {
|
|
18865
18858
|
this.options.growl = this.isGrowlCapable();
|
|
18866
18859
|
if (!this.options.growl) {
|
|
18867
18860
|
var detail = utils.isBrowser()
|
|
@@ -18910,11 +18903,11 @@
|
|
|
18910
18903
|
* // Specify variables to be expected in global scope
|
|
18911
18904
|
* mocha.global(['jQuery', 'MyLib']);
|
|
18912
18905
|
*/
|
|
18913
|
-
Mocha.prototype.global = function(global) {
|
|
18906
|
+
Mocha.prototype.global = function (global) {
|
|
18914
18907
|
this.options.global = (this.options.global || [])
|
|
18915
18908
|
.concat(global)
|
|
18916
18909
|
.filter(Boolean)
|
|
18917
|
-
.filter(function(elt, idx, arr) {
|
|
18910
|
+
.filter(function (elt, idx, arr) {
|
|
18918
18911
|
return arr.indexOf(elt) === idx;
|
|
18919
18912
|
});
|
|
18920
18913
|
return this;
|
|
@@ -18931,7 +18924,7 @@
|
|
|
18931
18924
|
* @return {Mocha} this
|
|
18932
18925
|
* @chainable
|
|
18933
18926
|
*/
|
|
18934
|
-
Mocha.prototype.color = function(color) {
|
|
18927
|
+
Mocha.prototype.color = function (color) {
|
|
18935
18928
|
this.options.color = color !== false;
|
|
18936
18929
|
return this;
|
|
18937
18930
|
};
|
|
@@ -18946,7 +18939,7 @@
|
|
|
18946
18939
|
* @return {Mocha} this
|
|
18947
18940
|
* @chainable
|
|
18948
18941
|
*/
|
|
18949
|
-
Mocha.prototype.inlineDiffs = function(inlineDiffs) {
|
|
18942
|
+
Mocha.prototype.inlineDiffs = function (inlineDiffs) {
|
|
18950
18943
|
this.options.inlineDiffs = inlineDiffs !== false;
|
|
18951
18944
|
return this;
|
|
18952
18945
|
};
|
|
@@ -18960,7 +18953,7 @@
|
|
|
18960
18953
|
* @return {Mocha} this
|
|
18961
18954
|
* @chainable
|
|
18962
18955
|
*/
|
|
18963
|
-
Mocha.prototype.diff = function(diff) {
|
|
18956
|
+
Mocha.prototype.diff = function (diff) {
|
|
18964
18957
|
this.options.diff = diff !== false;
|
|
18965
18958
|
return this;
|
|
18966
18959
|
};
|
|
@@ -18988,7 +18981,7 @@
|
|
|
18988
18981
|
* // Same as above but using string argument
|
|
18989
18982
|
* mocha.timeout('1s');
|
|
18990
18983
|
*/
|
|
18991
|
-
Mocha.prototype.timeout = function(msecs) {
|
|
18984
|
+
Mocha.prototype.timeout = function (msecs) {
|
|
18992
18985
|
this.suite.timeout(msecs);
|
|
18993
18986
|
return this;
|
|
18994
18987
|
};
|
|
@@ -19007,7 +19000,7 @@
|
|
|
19007
19000
|
* // Allow any failed test to retry one more time
|
|
19008
19001
|
* mocha.retries(1);
|
|
19009
19002
|
*/
|
|
19010
|
-
Mocha.prototype.retries = function(retry) {
|
|
19003
|
+
Mocha.prototype.retries = function (retry) {
|
|
19011
19004
|
this.suite.retries(retry);
|
|
19012
19005
|
return this;
|
|
19013
19006
|
};
|
|
@@ -19029,7 +19022,7 @@
|
|
|
19029
19022
|
* // Same as above but using string argument
|
|
19030
19023
|
* mocha.slow('0.5s');
|
|
19031
19024
|
*/
|
|
19032
|
-
Mocha.prototype.slow = function(msecs) {
|
|
19025
|
+
Mocha.prototype.slow = function (msecs) {
|
|
19033
19026
|
this.suite.slow(msecs);
|
|
19034
19027
|
return this;
|
|
19035
19028
|
};
|
|
@@ -19043,7 +19036,7 @@
|
|
|
19043
19036
|
* @return {Mocha} this
|
|
19044
19037
|
* @chainable
|
|
19045
19038
|
*/
|
|
19046
|
-
Mocha.prototype.asyncOnly = function(asyncOnly) {
|
|
19039
|
+
Mocha.prototype.asyncOnly = function (asyncOnly) {
|
|
19047
19040
|
this.options.asyncOnly = asyncOnly !== false;
|
|
19048
19041
|
return this;
|
|
19049
19042
|
};
|
|
@@ -19055,7 +19048,7 @@
|
|
|
19055
19048
|
* @return {Mocha} this
|
|
19056
19049
|
* @chainable
|
|
19057
19050
|
*/
|
|
19058
|
-
Mocha.prototype.noHighlighting = function() {
|
|
19051
|
+
Mocha.prototype.noHighlighting = function () {
|
|
19059
19052
|
this.options.noHighlighting = true;
|
|
19060
19053
|
return this;
|
|
19061
19054
|
};
|
|
@@ -19069,7 +19062,7 @@
|
|
|
19069
19062
|
* @return {Mocha} this
|
|
19070
19063
|
* @chainable
|
|
19071
19064
|
*/
|
|
19072
|
-
Mocha.prototype.allowUncaught = function(allowUncaught) {
|
|
19065
|
+
Mocha.prototype.allowUncaught = function (allowUncaught) {
|
|
19073
19066
|
this.options.allowUncaught = allowUncaught !== false;
|
|
19074
19067
|
return this;
|
|
19075
19068
|
};
|
|
@@ -19100,7 +19093,7 @@
|
|
|
19100
19093
|
* @return {Mocha} this
|
|
19101
19094
|
* @chainable
|
|
19102
19095
|
*/
|
|
19103
|
-
Mocha.prototype.dryRun = function(dryRun) {
|
|
19096
|
+
Mocha.prototype.dryRun = function (dryRun) {
|
|
19104
19097
|
this.options.dryRun = dryRun !== false;
|
|
19105
19098
|
return this;
|
|
19106
19099
|
};
|
|
@@ -19114,7 +19107,7 @@
|
|
|
19114
19107
|
* @return {Mocha} this
|
|
19115
19108
|
* @chainable
|
|
19116
19109
|
*/
|
|
19117
|
-
Mocha.prototype.failZero = function(failZero) {
|
|
19110
|
+
Mocha.prototype.failZero = function (failZero) {
|
|
19118
19111
|
this.options.failZero = failZero !== false;
|
|
19119
19112
|
return this;
|
|
19120
19113
|
};
|
|
@@ -19128,7 +19121,7 @@
|
|
|
19128
19121
|
* @returns {Mocha} this
|
|
19129
19122
|
* @chainable
|
|
19130
19123
|
*/
|
|
19131
|
-
Mocha.prototype.forbidOnly = function(forbidOnly) {
|
|
19124
|
+
Mocha.prototype.forbidOnly = function (forbidOnly) {
|
|
19132
19125
|
this.options.forbidOnly = forbidOnly !== false;
|
|
19133
19126
|
return this;
|
|
19134
19127
|
};
|
|
@@ -19142,7 +19135,7 @@
|
|
|
19142
19135
|
* @returns {Mocha} this
|
|
19143
19136
|
* @chainable
|
|
19144
19137
|
*/
|
|
19145
|
-
Mocha.prototype.forbidPending = function(forbidPending) {
|
|
19138
|
+
Mocha.prototype.forbidPending = function (forbidPending) {
|
|
19146
19139
|
this.options.forbidPending = forbidPending !== false;
|
|
19147
19140
|
return this;
|
|
19148
19141
|
};
|
|
@@ -19151,7 +19144,7 @@
|
|
|
19151
19144
|
* Throws an error if mocha is in the wrong state to be able to transition to a "running" state.
|
|
19152
19145
|
* @private
|
|
19153
19146
|
*/
|
|
19154
|
-
Mocha.prototype._guardRunningStateTransition = function() {
|
|
19147
|
+
Mocha.prototype._guardRunningStateTransition = function () {
|
|
19155
19148
|
if (this._state === mochaStates.RUNNING) {
|
|
19156
19149
|
throw createMochaInstanceAlreadyRunningError(
|
|
19157
19150
|
'Mocha instance is currently running tests, cannot start a next test run until this one is done',
|
|
@@ -19210,7 +19203,7 @@
|
|
|
19210
19203
|
* // exit with non-zero status if there were test failures
|
|
19211
19204
|
* mocha.run(failures => process.exitCode = failures ? 1 : 0);
|
|
19212
19205
|
*/
|
|
19213
|
-
Mocha.prototype.run = function(fn) {
|
|
19206
|
+
Mocha.prototype.run = function (fn) {
|
|
19214
19207
|
this._guardRunningStateTransition();
|
|
19215
19208
|
this._state = mochaStates.RUNNING;
|
|
19216
19209
|
if (this._previousRunner) {
|
|
@@ -19513,9 +19506,10 @@
|
|
|
19513
19506
|
* @public
|
|
19514
19507
|
* @returns {boolean}
|
|
19515
19508
|
*/
|
|
19516
|
-
Mocha.prototype.hasGlobalTeardownFixtures =
|
|
19517
|
-
|
|
19518
|
-
|
|
19509
|
+
Mocha.prototype.hasGlobalTeardownFixtures =
|
|
19510
|
+
function hasGlobalTeardownFixtures() {
|
|
19511
|
+
return Boolean(this.options.globalTeardown.length);
|
|
19512
|
+
};
|
|
19519
19513
|
|
|
19520
19514
|
/**
|
|
19521
19515
|
* An alternative way to define root hooks that works with parallel runs.
|
|
@@ -19607,12 +19601,12 @@
|
|
|
19607
19601
|
* Revert to original onerror handler if previously defined.
|
|
19608
19602
|
*/
|
|
19609
19603
|
|
|
19610
|
-
process$1.removeListener = function(e, fn) {
|
|
19604
|
+
process$1.removeListener = function (e, fn) {
|
|
19611
19605
|
if (e === 'uncaughtException') {
|
|
19612
19606
|
if (originalOnerrorHandler) {
|
|
19613
19607
|
commonjsGlobal.onerror = originalOnerrorHandler;
|
|
19614
19608
|
} else {
|
|
19615
|
-
commonjsGlobal.onerror = function() {};
|
|
19609
|
+
commonjsGlobal.onerror = function () {};
|
|
19616
19610
|
}
|
|
19617
19611
|
var i = uncaughtExceptionHandlers.indexOf(fn);
|
|
19618
19612
|
if (i !== -1) {
|
|
@@ -19625,7 +19619,7 @@
|
|
|
19625
19619
|
* Implements listenerCount for 'uncaughtException'.
|
|
19626
19620
|
*/
|
|
19627
19621
|
|
|
19628
|
-
process$1.listenerCount = function(name) {
|
|
19622
|
+
process$1.listenerCount = function (name) {
|
|
19629
19623
|
if (name === 'uncaughtException') {
|
|
19630
19624
|
return uncaughtExceptionHandlers.length;
|
|
19631
19625
|
}
|
|
@@ -19636,9 +19630,9 @@
|
|
|
19636
19630
|
* Implements uncaughtException listener.
|
|
19637
19631
|
*/
|
|
19638
19632
|
|
|
19639
|
-
process$1.on = function(e, fn) {
|
|
19633
|
+
process$1.on = function (e, fn) {
|
|
19640
19634
|
if (e === 'uncaughtException') {
|
|
19641
|
-
commonjsGlobal.onerror = function(err, url, line) {
|
|
19635
|
+
commonjsGlobal.onerror = function (err, url, line) {
|
|
19642
19636
|
fn(new Error(err + ' (' + url + ':' + line + ')'));
|
|
19643
19637
|
return !mocha.options.allowUncaught;
|
|
19644
19638
|
};
|
|
@@ -19646,7 +19640,7 @@
|
|
|
19646
19640
|
}
|
|
19647
19641
|
};
|
|
19648
19642
|
|
|
19649
|
-
process$1.listeners = function(e) {
|
|
19643
|
+
process$1.listeners = function (e) {
|
|
19650
19644
|
if (e === 'uncaughtException') {
|
|
19651
19645
|
return uncaughtExceptionHandlers;
|
|
19652
19646
|
}
|
|
@@ -19677,7 +19671,7 @@
|
|
|
19677
19671
|
* High-performance override of Runner.immediately.
|
|
19678
19672
|
*/
|
|
19679
19673
|
|
|
19680
|
-
mocha$1.Runner.immediately = function(callback) {
|
|
19674
|
+
mocha$1.Runner.immediately = function (callback) {
|
|
19681
19675
|
immediateQueue.push(callback);
|
|
19682
19676
|
if (!immediateTimeout) {
|
|
19683
19677
|
immediateTimeout = setTimeout$1(timeslice, 0);
|
|
@@ -19689,8 +19683,8 @@
|
|
|
19689
19683
|
* This is useful when running tests in a browser because window.onerror will
|
|
19690
19684
|
* only receive the 'message' attribute of the Error.
|
|
19691
19685
|
*/
|
|
19692
|
-
mocha.throwError = function(err) {
|
|
19693
|
-
uncaughtExceptionHandlers.forEach(function(fn) {
|
|
19686
|
+
mocha.throwError = function (err) {
|
|
19687
|
+
uncaughtExceptionHandlers.forEach(function (fn) {
|
|
19694
19688
|
fn(err);
|
|
19695
19689
|
});
|
|
19696
19690
|
throw err;
|
|
@@ -19701,7 +19695,7 @@
|
|
|
19701
19695
|
* Normally this would happen in Mocha.prototype.loadFiles.
|
|
19702
19696
|
*/
|
|
19703
19697
|
|
|
19704
|
-
mocha.ui = function(ui) {
|
|
19698
|
+
mocha.ui = function (ui) {
|
|
19705
19699
|
mocha$1.prototype.ui.call(this, ui);
|
|
19706
19700
|
this.suite.emit('pre-require', commonjsGlobal, null, this);
|
|
19707
19701
|
return this;
|
|
@@ -19711,7 +19705,7 @@
|
|
|
19711
19705
|
* Setup mocha with the given setting options.
|
|
19712
19706
|
*/
|
|
19713
19707
|
|
|
19714
|
-
mocha.setup = function(opts) {
|
|
19708
|
+
mocha.setup = function (opts) {
|
|
19715
19709
|
if (typeof opts === 'string') {
|
|
19716
19710
|
opts = {ui: opts};
|
|
19717
19711
|
}
|
|
@@ -19720,10 +19714,10 @@
|
|
|
19720
19714
|
}
|
|
19721
19715
|
var self = this;
|
|
19722
19716
|
Object.keys(opts)
|
|
19723
|
-
.filter(function(opt) {
|
|
19717
|
+
.filter(function (opt) {
|
|
19724
19718
|
return opt !== 'delay';
|
|
19725
19719
|
})
|
|
19726
|
-
.forEach(function(opt) {
|
|
19720
|
+
.forEach(function (opt) {
|
|
19727
19721
|
if (Object.prototype.hasOwnProperty.call(opts, opt)) {
|
|
19728
19722
|
self[opt](opts[opt]);
|
|
19729
19723
|
}
|
|
@@ -19735,7 +19729,7 @@
|
|
|
19735
19729
|
* Run mocha, returning the Runner.
|
|
19736
19730
|
*/
|
|
19737
19731
|
|
|
19738
|
-
mocha.run = function(fn) {
|
|
19732
|
+
mocha.run = function (fn) {
|
|
19739
19733
|
var options = mocha.options;
|
|
19740
19734
|
mocha.globals('location');
|
|
19741
19735
|
|
|
@@ -19750,7 +19744,7 @@
|
|
|
19750
19744
|
mocha.invert();
|
|
19751
19745
|
}
|
|
19752
19746
|
|
|
19753
|
-
return mocha$1.prototype.run.call(mocha, function(err) {
|
|
19747
|
+
return mocha$1.prototype.run.call(mocha, function (err) {
|
|
19754
19748
|
// The DOM Document is not available in Web Workers.
|
|
19755
19749
|
var document = commonjsGlobal.document;
|
|
19756
19750
|
if (
|