mocha 11.7.4 → 11.7.6
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/bin/_mocha +2 -2
- package/bin/mocha.js +46 -44
- package/browser-entry.js +20 -20
- package/index.js +2 -2
- package/lib/browser/highlight-tags.js +6 -6
- package/lib/browser/parse-query.js +5 -5
- package/lib/browser/template.html +2 -2
- package/lib/cli/cli.js +32 -27
- package/lib/cli/collect-files.js +25 -25
- package/lib/cli/commands.js +4 -4
- package/lib/cli/config.js +26 -25
- package/lib/cli/index.js +2 -2
- package/lib/cli/init.js +19 -19
- package/lib/cli/lookup-files.js +20 -20
- package/lib/cli/node-flags.js +12 -12
- package/lib/cli/one-and-dones.js +12 -11
- package/lib/cli/options.js +49 -49
- package/lib/cli/run-helpers.js +52 -54
- package/lib/cli/run-option-metadata.js +75 -75
- package/lib/cli/run.js +164 -159
- package/lib/cli/watch-run.js +75 -75
- package/lib/context.js +1 -1
- package/lib/error-constants.js +17 -17
- package/lib/errors.js +26 -26
- package/lib/hook.js +9 -9
- package/lib/interfaces/bdd.js +8 -8
- package/lib/interfaces/common.js +12 -12
- package/lib/interfaces/exports.js +8 -8
- package/lib/interfaces/index.js +5 -5
- package/lib/interfaces/qunit.js +7 -7
- package/lib/interfaces/tdd.js +7 -7
- package/lib/mocha.js +97 -97
- package/lib/nodejs/buffered-worker-pool.js +30 -30
- package/lib/nodejs/esm-utils.js +24 -21
- package/lib/nodejs/file-unloader.js +2 -2
- package/lib/nodejs/parallel-buffered-runner.js +67 -67
- package/lib/nodejs/reporters/parallel-buffered.js +13 -10
- package/lib/nodejs/serializer.js +47 -47
- package/lib/nodejs/worker.js +38 -38
- package/lib/pending.js +1 -1
- package/lib/plugin-loader.js +48 -48
- package/lib/reporters/base.js +97 -94
- package/lib/reporters/doc.js +17 -17
- package/lib/reporters/dot.js +14 -14
- package/lib/reporters/html.js +73 -67
- package/lib/reporters/index.js +16 -16
- package/lib/reporters/json-stream.js +10 -10
- package/lib/reporters/json.js +16 -16
- package/lib/reporters/landing.js +20 -20
- package/lib/reporters/list.js +10 -10
- package/lib/reporters/markdown.js +21 -21
- package/lib/reporters/min.js +7 -7
- package/lib/reporters/nyan.js +35 -35
- package/lib/reporters/progress.js +14 -14
- package/lib/reporters/spec.js +15 -15
- package/lib/reporters/tap.js +26 -26
- package/lib/reporters/xunit.js +38 -34
- package/lib/runnable.js +41 -41
- package/lib/runner.js +105 -105
- package/lib/stats-collector.js +4 -4
- package/lib/suite.js +56 -46
- package/lib/test.js +10 -10
- package/lib/utils.js +122 -122
- package/mocha.css +68 -50
- package/mocha.js +826 -803
- package/mocha.js.map +1 -1
- package/package.json +8 -13
package/mocha.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// mocha@11.7.
|
|
1
|
+
// mocha@11.7.6 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) :
|
|
@@ -5478,15 +5478,15 @@
|
|
|
5478
5478
|
*/
|
|
5479
5479
|
var parseQuery$1 = function parseQuery(qs) {
|
|
5480
5480
|
return qs
|
|
5481
|
-
.replace(
|
|
5482
|
-
.split(
|
|
5481
|
+
.replace("?", "")
|
|
5482
|
+
.split("&")
|
|
5483
5483
|
.reduce(function (obj, pair) {
|
|
5484
|
-
var i = pair.indexOf(
|
|
5484
|
+
var i = pair.indexOf("=");
|
|
5485
5485
|
var key = pair.slice(0, i);
|
|
5486
5486
|
var val = pair.slice(++i);
|
|
5487
5487
|
|
|
5488
5488
|
// Due to how the URLSearchParams API treats spaces
|
|
5489
|
-
obj[key] = decodeURIComponent(val.replace(/\+/g,
|
|
5489
|
+
obj[key] = decodeURIComponent(val.replace(/\+/g, "%20"));
|
|
5490
5490
|
|
|
5491
5491
|
return obj;
|
|
5492
5492
|
}, {});
|
|
@@ -5501,19 +5501,19 @@
|
|
|
5501
5501
|
*/
|
|
5502
5502
|
function highlight(js) {
|
|
5503
5503
|
return js
|
|
5504
|
-
.replace(/</g,
|
|
5505
|
-
.replace(/>/g,
|
|
5504
|
+
.replace(/</g, "<")
|
|
5505
|
+
.replace(/>/g, ">")
|
|
5506
5506
|
.replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
|
|
5507
5507
|
.replace(/('.*?')/gm, '<span class="string">$1</span>')
|
|
5508
5508
|
.replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
|
|
5509
5509
|
.replace(/(\d+)/gm, '<span class="number">$1</span>')
|
|
5510
5510
|
.replace(
|
|
5511
5511
|
/\bnew[ \t]+(\w+)/gm,
|
|
5512
|
-
'<span class="keyword">new</span> <span class="init">$1</span>'
|
|
5512
|
+
'<span class="keyword">new</span> <span class="init">$1</span>',
|
|
5513
5513
|
)
|
|
5514
5514
|
.replace(
|
|
5515
5515
|
/\b(function|new|throw|return|var|if|else)\b/gm,
|
|
5516
|
-
'<span class="keyword">$1</span>'
|
|
5516
|
+
'<span class="keyword">$1</span>',
|
|
5517
5517
|
);
|
|
5518
5518
|
}
|
|
5519
5519
|
|
|
@@ -5524,7 +5524,7 @@
|
|
|
5524
5524
|
* @param {string} name
|
|
5525
5525
|
*/
|
|
5526
5526
|
var highlightTags$1 = function highlightTags(name) {
|
|
5527
|
-
var code = document.getElementById(
|
|
5527
|
+
var code = document.getElementById("mocha").getElementsByTagName(name);
|
|
5528
5528
|
for (var i = 0, len = code.length; i < len; ++i) {
|
|
5529
5529
|
code[i].innerHTML = highlight(code[i].innerHTML);
|
|
5530
5530
|
}
|
|
@@ -11737,7 +11737,7 @@
|
|
|
11737
11737
|
var util = require$$0$1;
|
|
11738
11738
|
var he$1 = he.exports;
|
|
11739
11739
|
|
|
11740
|
-
const MOCHA_ID_PROP_NAME =
|
|
11740
|
+
const MOCHA_ID_PROP_NAME = "__mocha_id__";
|
|
11741
11741
|
|
|
11742
11742
|
/**
|
|
11743
11743
|
* Inherit the prototype methods from one constructor into another.
|
|
@@ -11758,7 +11758,7 @@
|
|
|
11758
11758
|
* @return {string}
|
|
11759
11759
|
*/
|
|
11760
11760
|
exports.escape = function (html) {
|
|
11761
|
-
return he$1.encode(String(html), {useNamedReferences: false});
|
|
11761
|
+
return he$1.encode(String(html), { useNamedReferences: false });
|
|
11762
11762
|
};
|
|
11763
11763
|
|
|
11764
11764
|
/**
|
|
@@ -11769,7 +11769,7 @@
|
|
|
11769
11769
|
* @return {boolean}
|
|
11770
11770
|
*/
|
|
11771
11771
|
exports.isString = function (obj) {
|
|
11772
|
-
return typeof obj ===
|
|
11772
|
+
return typeof obj === "string";
|
|
11773
11773
|
};
|
|
11774
11774
|
|
|
11775
11775
|
/**
|
|
@@ -11782,9 +11782,9 @@
|
|
|
11782
11782
|
exports.slug = function (str) {
|
|
11783
11783
|
return str
|
|
11784
11784
|
.toLowerCase()
|
|
11785
|
-
.replace(/\s+/g,
|
|
11786
|
-
.replace(/[^-\w]/g,
|
|
11787
|
-
.replace(/-{2,}/g,
|
|
11785
|
+
.replace(/\s+/g, "-")
|
|
11786
|
+
.replace(/[^-\w]/g, "")
|
|
11787
|
+
.replace(/-{2,}/g, "-");
|
|
11788
11788
|
};
|
|
11789
11789
|
|
|
11790
11790
|
/**
|
|
@@ -11795,22 +11795,22 @@
|
|
|
11795
11795
|
*/
|
|
11796
11796
|
exports.clean = function (str) {
|
|
11797
11797
|
str = str
|
|
11798
|
-
.replace(/\r\n?|[\n\u2028\u2029]/g,
|
|
11799
|
-
.replace(/^\uFEFF/,
|
|
11798
|
+
.replace(/\r\n?|[\n\u2028\u2029]/g, "\n")
|
|
11799
|
+
.replace(/^\uFEFF/, "")
|
|
11800
11800
|
// (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
|
|
11801
11801
|
.replace(
|
|
11802
11802
|
/^function(?:\s*|\s[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\}|((?:.|\n)*))$/,
|
|
11803
|
-
|
|
11803
|
+
"$1$2$3",
|
|
11804
11804
|
);
|
|
11805
11805
|
|
|
11806
11806
|
var spaces = str.match(/^\n?( *)/)[1].length;
|
|
11807
11807
|
var tabs = str.match(/^\n?(\t*)/)[1].length;
|
|
11808
11808
|
var re = new RegExp(
|
|
11809
|
-
|
|
11810
|
-
|
|
11809
|
+
"^\n?" + (tabs ? "\t" : " ") + "{" + (tabs || spaces) + "}",
|
|
11810
|
+
"gm",
|
|
11811
11811
|
);
|
|
11812
11812
|
|
|
11813
|
-
str = str.replace(re,
|
|
11813
|
+
str = str.replace(re, "");
|
|
11814
11814
|
|
|
11815
11815
|
return str.trim();
|
|
11816
11816
|
};
|
|
@@ -11831,12 +11831,12 @@
|
|
|
11831
11831
|
*/
|
|
11832
11832
|
function emptyRepresentation(value, typeHint) {
|
|
11833
11833
|
switch (typeHint) {
|
|
11834
|
-
case
|
|
11835
|
-
return
|
|
11836
|
-
case
|
|
11837
|
-
return
|
|
11838
|
-
case
|
|
11839
|
-
return
|
|
11834
|
+
case "function":
|
|
11835
|
+
return "[Function]";
|
|
11836
|
+
case "object":
|
|
11837
|
+
return "{}";
|
|
11838
|
+
case "array":
|
|
11839
|
+
return "[]";
|
|
11840
11840
|
default:
|
|
11841
11841
|
return value.toString();
|
|
11842
11842
|
}
|
|
@@ -11867,18 +11867,18 @@
|
|
|
11867
11867
|
*/
|
|
11868
11868
|
var canonicalType = (exports.canonicalType = function canonicalType(value) {
|
|
11869
11869
|
if (value === undefined) {
|
|
11870
|
-
return
|
|
11870
|
+
return "undefined";
|
|
11871
11871
|
} else if (value === null) {
|
|
11872
|
-
return
|
|
11872
|
+
return "null";
|
|
11873
11873
|
} else if (isBuffer(value)) {
|
|
11874
|
-
return
|
|
11874
|
+
return "buffer";
|
|
11875
11875
|
} else if (Object.getPrototypeOf(value) === null) {
|
|
11876
|
-
return
|
|
11876
|
+
return "null-prototype";
|
|
11877
11877
|
}
|
|
11878
11878
|
|
|
11879
11879
|
return Object.prototype.toString
|
|
11880
11880
|
.call(value)
|
|
11881
|
-
.replace(/^\[.+\s(.+?)]$/,
|
|
11881
|
+
.replace(/^\[.+\s(.+?)]$/, "$1")
|
|
11882
11882
|
.toLowerCase();
|
|
11883
11883
|
});
|
|
11884
11884
|
|
|
@@ -11904,21 +11904,21 @@
|
|
|
11904
11904
|
*/
|
|
11905
11905
|
exports.type = function type(value) {
|
|
11906
11906
|
// Null is special
|
|
11907
|
-
if (value === null) return
|
|
11907
|
+
if (value === null) return "null";
|
|
11908
11908
|
const primitives = new Set([
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11909
|
+
"undefined",
|
|
11910
|
+
"boolean",
|
|
11911
|
+
"number",
|
|
11912
|
+
"string",
|
|
11913
|
+
"bigint",
|
|
11914
|
+
"symbol",
|
|
11915
11915
|
]);
|
|
11916
11916
|
const _type = typeof value;
|
|
11917
|
-
if (_type ===
|
|
11917
|
+
if (_type === "function") return _type;
|
|
11918
11918
|
if (primitives.has(_type)) return _type;
|
|
11919
|
-
if (value instanceof String) return
|
|
11920
|
-
if (value instanceof Error) return
|
|
11921
|
-
if (Array.isArray(value)) return
|
|
11919
|
+
if (value instanceof String) return "string";
|
|
11920
|
+
if (value instanceof Error) return "error";
|
|
11921
|
+
if (Array.isArray(value)) return "array";
|
|
11922
11922
|
|
|
11923
11923
|
return _type;
|
|
11924
11924
|
};
|
|
@@ -11941,24 +11941,24 @@
|
|
|
11941
11941
|
exports.stringify = function (value) {
|
|
11942
11942
|
var typeHint = canonicalType(value);
|
|
11943
11943
|
|
|
11944
|
-
if (!~[
|
|
11945
|
-
if (typeHint ===
|
|
11944
|
+
if (!~["object", "array", "function", "null-prototype"].indexOf(typeHint)) {
|
|
11945
|
+
if (typeHint === "buffer") {
|
|
11946
11946
|
var json = Buffer.prototype.toJSON.call(value);
|
|
11947
11947
|
// Based on the toJSON result
|
|
11948
11948
|
return jsonStringify(
|
|
11949
11949
|
json.data && json.type ? json.data : json,
|
|
11950
|
-
2
|
|
11951
|
-
).replace(/,(\n|$)/g,
|
|
11950
|
+
2,
|
|
11951
|
+
).replace(/,(\n|$)/g, "$1");
|
|
11952
11952
|
}
|
|
11953
11953
|
|
|
11954
11954
|
// IE7/IE8 has a bizarre String constructor; needs to be coerced
|
|
11955
11955
|
// into an array and back to obj.
|
|
11956
|
-
if (typeHint ===
|
|
11957
|
-
value = value.split(
|
|
11956
|
+
if (typeHint === "string" && typeof value === "object") {
|
|
11957
|
+
value = value.split("").reduce(function (acc, char, idx) {
|
|
11958
11958
|
acc[idx] = char;
|
|
11959
11959
|
return acc;
|
|
11960
11960
|
}, {});
|
|
11961
|
-
typeHint =
|
|
11961
|
+
typeHint = "object";
|
|
11962
11962
|
} else {
|
|
11963
11963
|
return jsonStringify(value);
|
|
11964
11964
|
}
|
|
@@ -11968,8 +11968,8 @@
|
|
|
11968
11968
|
if (Object.prototype.hasOwnProperty.call(value, prop)) {
|
|
11969
11969
|
return jsonStringify(
|
|
11970
11970
|
exports.canonicalize(value, null, typeHint),
|
|
11971
|
-
2
|
|
11972
|
-
).replace(/,(\n|$)/g,
|
|
11971
|
+
2,
|
|
11972
|
+
).replace(/,(\n|$)/g, "$1");
|
|
11973
11973
|
}
|
|
11974
11974
|
}
|
|
11975
11975
|
|
|
@@ -11986,17 +11986,17 @@
|
|
|
11986
11986
|
* @returns {*}
|
|
11987
11987
|
*/
|
|
11988
11988
|
function jsonStringify(object, spaces, depth) {
|
|
11989
|
-
if (typeof spaces ===
|
|
11989
|
+
if (typeof spaces === "undefined") {
|
|
11990
11990
|
// primitive types
|
|
11991
11991
|
return _stringify(object);
|
|
11992
11992
|
}
|
|
11993
11993
|
|
|
11994
11994
|
depth = depth || 1;
|
|
11995
11995
|
var space = spaces * depth;
|
|
11996
|
-
var str = Array.isArray(object) ?
|
|
11997
|
-
var end = Array.isArray(object) ?
|
|
11996
|
+
var str = Array.isArray(object) ? "[" : "{";
|
|
11997
|
+
var end = Array.isArray(object) ? "]" : "}";
|
|
11998
11998
|
var length =
|
|
11999
|
-
typeof object.length ===
|
|
11999
|
+
typeof object.length === "number"
|
|
12000
12000
|
? object.length
|
|
12001
12001
|
: Object.keys(object).length;
|
|
12002
12002
|
// `.repeat()` polyfill
|
|
@@ -12006,39 +12006,39 @@
|
|
|
12006
12006
|
|
|
12007
12007
|
function _stringify(val) {
|
|
12008
12008
|
switch (canonicalType(val)) {
|
|
12009
|
-
case
|
|
12010
|
-
case
|
|
12011
|
-
val =
|
|
12009
|
+
case "null":
|
|
12010
|
+
case "undefined":
|
|
12011
|
+
val = "[" + val + "]";
|
|
12012
12012
|
break;
|
|
12013
|
-
case
|
|
12014
|
-
case
|
|
12013
|
+
case "array":
|
|
12014
|
+
case "object":
|
|
12015
12015
|
val = jsonStringify(val, spaces, depth + 1);
|
|
12016
12016
|
break;
|
|
12017
|
-
case
|
|
12018
|
-
case
|
|
12019
|
-
case
|
|
12020
|
-
case
|
|
12017
|
+
case "boolean":
|
|
12018
|
+
case "regexp":
|
|
12019
|
+
case "symbol":
|
|
12020
|
+
case "number":
|
|
12021
12021
|
val =
|
|
12022
12022
|
val === 0 && 1 / val === -Infinity // `-0`
|
|
12023
|
-
?
|
|
12023
|
+
? "-0"
|
|
12024
12024
|
: val.toString();
|
|
12025
12025
|
break;
|
|
12026
|
-
case
|
|
12027
|
-
val = val.toString() +
|
|
12026
|
+
case "bigint":
|
|
12027
|
+
val = val.toString() + "n";
|
|
12028
12028
|
break;
|
|
12029
|
-
case
|
|
12029
|
+
case "date":
|
|
12030
12030
|
var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
|
|
12031
|
-
val =
|
|
12031
|
+
val = "[Date: " + sDate + "]";
|
|
12032
12032
|
break;
|
|
12033
|
-
case
|
|
12033
|
+
case "buffer":
|
|
12034
12034
|
var json = val.toJSON();
|
|
12035
12035
|
// Based on the toJSON result
|
|
12036
12036
|
json = json.data && json.type ? json.data : json;
|
|
12037
|
-
val =
|
|
12037
|
+
val = "[Buffer: " + jsonStringify(json, 2, depth + 1) + "]";
|
|
12038
12038
|
break;
|
|
12039
12039
|
default:
|
|
12040
12040
|
val =
|
|
12041
|
-
val ===
|
|
12041
|
+
val === "[Function]" || val === "[Circular]"
|
|
12042
12042
|
? val
|
|
12043
12043
|
: JSON.stringify(val); // string
|
|
12044
12044
|
}
|
|
@@ -12051,17 +12051,17 @@
|
|
|
12051
12051
|
}
|
|
12052
12052
|
--length;
|
|
12053
12053
|
str +=
|
|
12054
|
-
|
|
12055
|
-
repeat(
|
|
12056
|
-
(Array.isArray(object) ?
|
|
12054
|
+
"\n " +
|
|
12055
|
+
repeat(" ", space) +
|
|
12056
|
+
(Array.isArray(object) ? "" : '"' + i + '": ') + // key
|
|
12057
12057
|
_stringify(object[i]) + // value
|
|
12058
|
-
(length ?
|
|
12058
|
+
(length ? "," : ""); // comma
|
|
12059
12059
|
}
|
|
12060
12060
|
|
|
12061
12061
|
return (
|
|
12062
12062
|
str +
|
|
12063
12063
|
// [], {}
|
|
12064
|
-
(str.length !== 1 ?
|
|
12064
|
+
(str.length !== 1 ? "\n" + repeat(" ", --space) + end : end)
|
|
12065
12065
|
);
|
|
12066
12066
|
}
|
|
12067
12067
|
|
|
@@ -12099,23 +12099,23 @@
|
|
|
12099
12099
|
stack = stack || [];
|
|
12100
12100
|
|
|
12101
12101
|
if (stack.indexOf(value) !== -1) {
|
|
12102
|
-
return
|
|
12102
|
+
return "[Circular]";
|
|
12103
12103
|
}
|
|
12104
12104
|
|
|
12105
12105
|
switch (typeHint) {
|
|
12106
|
-
case
|
|
12107
|
-
case
|
|
12108
|
-
case
|
|
12106
|
+
case "undefined":
|
|
12107
|
+
case "buffer":
|
|
12108
|
+
case "null":
|
|
12109
12109
|
canonicalizedObj = value;
|
|
12110
12110
|
break;
|
|
12111
|
-
case
|
|
12111
|
+
case "array":
|
|
12112
12112
|
withStack(value, function () {
|
|
12113
12113
|
canonicalizedObj = value.map(function (item) {
|
|
12114
12114
|
return exports.canonicalize(item, stack);
|
|
12115
12115
|
});
|
|
12116
12116
|
});
|
|
12117
12117
|
break;
|
|
12118
|
-
case
|
|
12118
|
+
case "function":
|
|
12119
12119
|
/* eslint-disable-next-line no-unused-vars, no-unreachable-loop */
|
|
12120
12120
|
for (prop in value) {
|
|
12121
12121
|
canonicalizedObj = {};
|
|
@@ -12127,11 +12127,11 @@
|
|
|
12127
12127
|
break;
|
|
12128
12128
|
}
|
|
12129
12129
|
/* falls through */
|
|
12130
|
-
case
|
|
12131
|
-
case
|
|
12130
|
+
case "null-prototype":
|
|
12131
|
+
case "object":
|
|
12132
12132
|
canonicalizedObj = canonicalizedObj || {};
|
|
12133
|
-
if (typeHint ===
|
|
12134
|
-
canonicalizedObj[
|
|
12133
|
+
if (typeHint === "null-prototype" && Symbol.toStringTag in value) {
|
|
12134
|
+
canonicalizedObj["[Symbol.toStringTag]"] = value[Symbol.toStringTag];
|
|
12135
12135
|
}
|
|
12136
12136
|
withStack(value, function () {
|
|
12137
12137
|
Object.keys(value)
|
|
@@ -12141,15 +12141,15 @@
|
|
|
12141
12141
|
});
|
|
12142
12142
|
});
|
|
12143
12143
|
break;
|
|
12144
|
-
case
|
|
12145
|
-
case
|
|
12146
|
-
case
|
|
12147
|
-
case
|
|
12148
|
-
case
|
|
12144
|
+
case "date":
|
|
12145
|
+
case "number":
|
|
12146
|
+
case "regexp":
|
|
12147
|
+
case "boolean":
|
|
12148
|
+
case "symbol":
|
|
12149
12149
|
canonicalizedObj = value;
|
|
12150
12150
|
break;
|
|
12151
12151
|
default:
|
|
12152
|
-
canonicalizedObj = value +
|
|
12152
|
+
canonicalizedObj = value + "";
|
|
12153
12153
|
}
|
|
12154
12154
|
|
|
12155
12155
|
return canonicalizedObj;
|
|
@@ -12166,39 +12166,39 @@
|
|
|
12166
12166
|
*/
|
|
12167
12167
|
exports.stackTraceFilter = function () {
|
|
12168
12168
|
// TODO: Replace with `process.browser`
|
|
12169
|
-
var is = typeof document ===
|
|
12169
|
+
var is = typeof document === "undefined" ? { node: true } : { browser: true };
|
|
12170
12170
|
var slash = path.sep;
|
|
12171
12171
|
var cwd;
|
|
12172
12172
|
if (is.node) {
|
|
12173
12173
|
cwd = exports.cwd() + slash;
|
|
12174
12174
|
} else {
|
|
12175
12175
|
cwd = (
|
|
12176
|
-
typeof location ===
|
|
12177
|
-
).href.replace(/\/[^/]*$/,
|
|
12178
|
-
slash =
|
|
12176
|
+
typeof location === "undefined" ? window.location : location
|
|
12177
|
+
).href.replace(/\/[^/]*$/, "/");
|
|
12178
|
+
slash = "/";
|
|
12179
12179
|
}
|
|
12180
12180
|
|
|
12181
12181
|
function isMochaInternal(line) {
|
|
12182
12182
|
return (
|
|
12183
|
-
~line.indexOf(
|
|
12184
|
-
~line.indexOf(slash +
|
|
12185
|
-
~line.indexOf(slash +
|
|
12183
|
+
~line.indexOf("node_modules" + slash + "mocha" + slash) ||
|
|
12184
|
+
~line.indexOf(slash + "mocha.js") ||
|
|
12185
|
+
~line.indexOf(slash + "mocha.min.js")
|
|
12186
12186
|
);
|
|
12187
12187
|
}
|
|
12188
12188
|
|
|
12189
12189
|
function isNodeInternal(line) {
|
|
12190
12190
|
return (
|
|
12191
|
-
~line.indexOf(
|
|
12192
|
-
~line.indexOf(
|
|
12193
|
-
~line.indexOf(
|
|
12194
|
-
~line.indexOf(
|
|
12195
|
-
~line.indexOf(
|
|
12191
|
+
~line.indexOf("(timers.js:") ||
|
|
12192
|
+
~line.indexOf("(events.js:") ||
|
|
12193
|
+
~line.indexOf("(node.js:") ||
|
|
12194
|
+
~line.indexOf("(module.js:") ||
|
|
12195
|
+
~line.indexOf("GeneratorFunctionPrototype.next (native)") ||
|
|
12196
12196
|
false
|
|
12197
12197
|
);
|
|
12198
12198
|
}
|
|
12199
12199
|
|
|
12200
12200
|
return function (stack) {
|
|
12201
|
-
stack = stack.split(
|
|
12201
|
+
stack = stack.split("\n");
|
|
12202
12202
|
|
|
12203
12203
|
stack = stack.reduce(function (list, line) {
|
|
12204
12204
|
if (isMochaInternal(line)) {
|
|
@@ -12211,14 +12211,14 @@
|
|
|
12211
12211
|
|
|
12212
12212
|
// Clean up cwd(absolute)
|
|
12213
12213
|
if (/:\d+:\d+\)?$/.test(line)) {
|
|
12214
|
-
line = line.replace(
|
|
12214
|
+
line = line.replace("(" + cwd, "(");
|
|
12215
12215
|
}
|
|
12216
12216
|
|
|
12217
12217
|
list.push(line);
|
|
12218
12218
|
return list;
|
|
12219
12219
|
}, []);
|
|
12220
12220
|
|
|
12221
|
-
return stack.join(
|
|
12221
|
+
return stack.join("\n");
|
|
12222
12222
|
};
|
|
12223
12223
|
};
|
|
12224
12224
|
|
|
@@ -12230,9 +12230,9 @@
|
|
|
12230
12230
|
*/
|
|
12231
12231
|
exports.isPromise = function isPromise(value) {
|
|
12232
12232
|
return (
|
|
12233
|
-
typeof value ===
|
|
12233
|
+
typeof value === "object" &&
|
|
12234
12234
|
value !== null &&
|
|
12235
|
-
typeof value.then ===
|
|
12235
|
+
typeof value.then === "function"
|
|
12236
12236
|
);
|
|
12237
12237
|
};
|
|
12238
12238
|
|
|
@@ -12271,7 +12271,7 @@
|
|
|
12271
12271
|
exports.createMap = function () {
|
|
12272
12272
|
return Object.assign.apply(
|
|
12273
12273
|
null,
|
|
12274
|
-
[Object.create(null)].concat(Array.prototype.slice.call(arguments))
|
|
12274
|
+
[Object.create(null)].concat(Array.prototype.slice.call(arguments)),
|
|
12275
12275
|
);
|
|
12276
12276
|
};
|
|
12277
12277
|
|
|
@@ -12288,8 +12288,8 @@
|
|
|
12288
12288
|
* @throws {TypeError} if argument is not a non-empty object.
|
|
12289
12289
|
*/
|
|
12290
12290
|
exports.defineConstants = function (obj) {
|
|
12291
|
-
if (canonicalType(obj) !==
|
|
12292
|
-
throw new TypeError(
|
|
12291
|
+
if (canonicalType(obj) !== "object" || !Object.keys(obj).length) {
|
|
12292
|
+
throw new TypeError("Invalid argument; expected a non-empty object");
|
|
12293
12293
|
}
|
|
12294
12294
|
return Object.freeze(exports.createMap(obj));
|
|
12295
12295
|
};
|
|
@@ -12333,8 +12333,8 @@
|
|
|
12333
12333
|
return [null];
|
|
12334
12334
|
}
|
|
12335
12335
|
if (
|
|
12336
|
-
typeof value ===
|
|
12337
|
-
(typeof value[Symbol.iterator] ===
|
|
12336
|
+
typeof value === "object" &&
|
|
12337
|
+
(typeof value[Symbol.iterator] === "function" || value.length !== undefined)
|
|
12338
12338
|
) {
|
|
12339
12339
|
return Array.from(value);
|
|
12340
12340
|
}
|
|
@@ -12342,11 +12342,11 @@
|
|
|
12342
12342
|
};
|
|
12343
12343
|
|
|
12344
12344
|
exports.constants = exports.defineConstants({
|
|
12345
|
-
MOCHA_ID_PROP_NAME
|
|
12345
|
+
MOCHA_ID_PROP_NAME,
|
|
12346
12346
|
});
|
|
12347
12347
|
|
|
12348
12348
|
const uniqueIDBase =
|
|
12349
|
-
|
|
12349
|
+
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
|
|
12350
12350
|
|
|
12351
12351
|
/**
|
|
12352
12352
|
* Creates a new unique identifier
|
|
@@ -12355,19 +12355,19 @@
|
|
|
12355
12355
|
* @returns {string} Unique identifier
|
|
12356
12356
|
*/
|
|
12357
12357
|
exports.uniqueID = () => {
|
|
12358
|
-
let id =
|
|
12358
|
+
let id = "";
|
|
12359
12359
|
for (let i = 0; i < 21; i++) {
|
|
12360
12360
|
id += uniqueIDBase[(Math.random() * 64) | 0];
|
|
12361
12361
|
}
|
|
12362
12362
|
return id;
|
|
12363
12363
|
};
|
|
12364
12364
|
|
|
12365
|
-
exports.assignNewMochaID = obj => {
|
|
12365
|
+
exports.assignNewMochaID = (obj) => {
|
|
12366
12366
|
const id = exports.uniqueID();
|
|
12367
12367
|
Object.defineProperty(obj, MOCHA_ID_PROP_NAME, {
|
|
12368
12368
|
get() {
|
|
12369
12369
|
return id;
|
|
12370
|
-
}
|
|
12370
|
+
},
|
|
12371
12371
|
});
|
|
12372
12372
|
return obj;
|
|
12373
12373
|
};
|
|
@@ -12377,8 +12377,8 @@
|
|
|
12377
12377
|
* @param {*} [obj] - Object
|
|
12378
12378
|
* @returns {string|void}
|
|
12379
12379
|
*/
|
|
12380
|
-
exports.getMochaID = obj =>
|
|
12381
|
-
obj && typeof obj ===
|
|
12380
|
+
exports.getMochaID = (obj) =>
|
|
12381
|
+
obj && typeof obj === "object" ? obj[MOCHA_ID_PROP_NAME] : undefined;
|
|
12382
12382
|
|
|
12383
12383
|
/**
|
|
12384
12384
|
* Replaces any detected circular dependency with the string '[Circular]'
|
|
@@ -12386,16 +12386,16 @@
|
|
|
12386
12386
|
* @param inputObj {*}
|
|
12387
12387
|
* @returns {*}
|
|
12388
12388
|
*/
|
|
12389
|
-
exports.breakCircularDeps = inputObj => {
|
|
12389
|
+
exports.breakCircularDeps = (inputObj) => {
|
|
12390
12390
|
const seen = new Set();
|
|
12391
12391
|
|
|
12392
12392
|
function _breakCircularDeps(obj) {
|
|
12393
|
-
if (obj && typeof obj !==
|
|
12393
|
+
if (obj && typeof obj !== "object") {
|
|
12394
12394
|
return obj;
|
|
12395
12395
|
}
|
|
12396
12396
|
|
|
12397
12397
|
if (seen.has(obj)) {
|
|
12398
|
-
return
|
|
12398
|
+
return "[Circular]";
|
|
12399
12399
|
}
|
|
12400
12400
|
|
|
12401
12401
|
seen.add(obj);
|
|
@@ -12418,7 +12418,7 @@
|
|
|
12418
12418
|
/**
|
|
12419
12419
|
* Checks if provided input can be parsed as a JavaScript Number.
|
|
12420
12420
|
*/
|
|
12421
|
-
exports.isNumeric = input => {
|
|
12421
|
+
exports.isNumeric = (input) => {
|
|
12422
12422
|
return !isNaN(parseFloat(input));
|
|
12423
12423
|
};
|
|
12424
12424
|
}(utils$3));
|
|
@@ -13177,112 +13177,112 @@
|
|
|
13177
13177
|
* @constant
|
|
13178
13178
|
* @default
|
|
13179
13179
|
*/
|
|
13180
|
-
FATAL:
|
|
13180
|
+
FATAL: "ERR_MOCHA_FATAL",
|
|
13181
13181
|
|
|
13182
13182
|
/**
|
|
13183
13183
|
* The type of an argument to a function call is invalid
|
|
13184
13184
|
* @constant
|
|
13185
13185
|
* @default
|
|
13186
13186
|
*/
|
|
13187
|
-
INVALID_ARG_TYPE:
|
|
13187
|
+
INVALID_ARG_TYPE: "ERR_MOCHA_INVALID_ARG_TYPE",
|
|
13188
13188
|
|
|
13189
13189
|
/**
|
|
13190
13190
|
* The value of an argument to a function call is invalid
|
|
13191
13191
|
* @constant
|
|
13192
13192
|
* @default
|
|
13193
13193
|
*/
|
|
13194
|
-
INVALID_ARG_VALUE:
|
|
13194
|
+
INVALID_ARG_VALUE: "ERR_MOCHA_INVALID_ARG_VALUE",
|
|
13195
13195
|
|
|
13196
13196
|
/**
|
|
13197
13197
|
* Something was thrown, but it wasn't an `Error`
|
|
13198
13198
|
* @constant
|
|
13199
13199
|
* @default
|
|
13200
13200
|
*/
|
|
13201
|
-
INVALID_EXCEPTION:
|
|
13201
|
+
INVALID_EXCEPTION: "ERR_MOCHA_INVALID_EXCEPTION",
|
|
13202
13202
|
|
|
13203
13203
|
/**
|
|
13204
13204
|
* An interface (e.g., `Mocha.interfaces`) is unknown or invalid
|
|
13205
13205
|
* @constant
|
|
13206
13206
|
* @default
|
|
13207
13207
|
*/
|
|
13208
|
-
INVALID_INTERFACE:
|
|
13208
|
+
INVALID_INTERFACE: "ERR_MOCHA_INVALID_INTERFACE",
|
|
13209
13209
|
|
|
13210
13210
|
/**
|
|
13211
13211
|
* A reporter (.e.g, `Mocha.reporters`) is unknown or invalid
|
|
13212
13212
|
* @constant
|
|
13213
13213
|
* @default
|
|
13214
13214
|
*/
|
|
13215
|
-
INVALID_REPORTER:
|
|
13215
|
+
INVALID_REPORTER: "ERR_MOCHA_INVALID_REPORTER",
|
|
13216
13216
|
|
|
13217
13217
|
/**
|
|
13218
13218
|
* `done()` was called twice in a `Test` or `Hook` callback
|
|
13219
13219
|
* @constant
|
|
13220
13220
|
* @default
|
|
13221
13221
|
*/
|
|
13222
|
-
MULTIPLE_DONE:
|
|
13222
|
+
MULTIPLE_DONE: "ERR_MOCHA_MULTIPLE_DONE",
|
|
13223
13223
|
|
|
13224
13224
|
/**
|
|
13225
13225
|
* No files matched the pattern provided by the user
|
|
13226
13226
|
* @constant
|
|
13227
13227
|
* @default
|
|
13228
13228
|
*/
|
|
13229
|
-
NO_FILES_MATCH_PATTERN:
|
|
13229
|
+
NO_FILES_MATCH_PATTERN: "ERR_MOCHA_NO_FILES_MATCH_PATTERN",
|
|
13230
13230
|
|
|
13231
13231
|
/**
|
|
13232
13232
|
* Known, but unsupported behavior of some kind
|
|
13233
13233
|
* @constant
|
|
13234
13234
|
* @default
|
|
13235
13235
|
*/
|
|
13236
|
-
UNSUPPORTED:
|
|
13236
|
+
UNSUPPORTED: "ERR_MOCHA_UNSUPPORTED",
|
|
13237
13237
|
|
|
13238
13238
|
/**
|
|
13239
13239
|
* Invalid state transition occurring in `Mocha` instance
|
|
13240
13240
|
* @constant
|
|
13241
13241
|
* @default
|
|
13242
13242
|
*/
|
|
13243
|
-
INSTANCE_ALREADY_RUNNING:
|
|
13243
|
+
INSTANCE_ALREADY_RUNNING: "ERR_MOCHA_INSTANCE_ALREADY_RUNNING",
|
|
13244
13244
|
|
|
13245
13245
|
/**
|
|
13246
13246
|
* Invalid state transition occurring in `Mocha` instance
|
|
13247
13247
|
* @constant
|
|
13248
13248
|
* @default
|
|
13249
13249
|
*/
|
|
13250
|
-
INSTANCE_ALREADY_DISPOSED:
|
|
13250
|
+
INSTANCE_ALREADY_DISPOSED: "ERR_MOCHA_INSTANCE_ALREADY_DISPOSED",
|
|
13251
13251
|
|
|
13252
13252
|
/**
|
|
13253
13253
|
* Use of `only()` w/ `--forbid-only` results in this error.
|
|
13254
13254
|
* @constant
|
|
13255
13255
|
* @default
|
|
13256
13256
|
*/
|
|
13257
|
-
FORBIDDEN_EXCLUSIVITY:
|
|
13257
|
+
FORBIDDEN_EXCLUSIVITY: "ERR_MOCHA_FORBIDDEN_EXCLUSIVITY",
|
|
13258
13258
|
|
|
13259
13259
|
/**
|
|
13260
13260
|
* To be thrown when a user-defined plugin implementation (e.g., `mochaHooks`) is invalid
|
|
13261
13261
|
* @constant
|
|
13262
13262
|
* @default
|
|
13263
13263
|
*/
|
|
13264
|
-
INVALID_PLUGIN_IMPLEMENTATION:
|
|
13264
|
+
INVALID_PLUGIN_IMPLEMENTATION: "ERR_MOCHA_INVALID_PLUGIN_IMPLEMENTATION",
|
|
13265
13265
|
|
|
13266
13266
|
/**
|
|
13267
13267
|
* To be thrown when a builtin or third-party plugin definition (the _definition_ of `mochaHooks`) is invalid
|
|
13268
13268
|
* @constant
|
|
13269
13269
|
* @default
|
|
13270
13270
|
*/
|
|
13271
|
-
INVALID_PLUGIN_DEFINITION:
|
|
13271
|
+
INVALID_PLUGIN_DEFINITION: "ERR_MOCHA_INVALID_PLUGIN_DEFINITION",
|
|
13272
13272
|
|
|
13273
13273
|
/**
|
|
13274
13274
|
* When a runnable exceeds its allowed run time.
|
|
13275
13275
|
* @constant
|
|
13276
13276
|
* @default
|
|
13277
13277
|
*/
|
|
13278
|
-
TIMEOUT:
|
|
13278
|
+
TIMEOUT: "ERR_MOCHA_TIMEOUT",
|
|
13279
13279
|
|
|
13280
13280
|
/**
|
|
13281
13281
|
* Input file is not able to be parsed
|
|
13282
13282
|
* @constant
|
|
13283
13283
|
* @default
|
|
13284
13284
|
*/
|
|
13285
|
-
UNPARSABLE_FILE:
|
|
13285
|
+
UNPARSABLE_FILE: "ERR_MOCHA_UNPARSABLE_FILE",
|
|
13286
13286
|
};
|
|
13287
13287
|
|
|
13288
13288
|
var errorConstants$1 = { constants: constants$5 };
|
|
@@ -13294,7 +13294,7 @@
|
|
|
13294
13294
|
* @typedef {import('./types.d.ts').PluginDefinition} PluginDefinition
|
|
13295
13295
|
*/
|
|
13296
13296
|
|
|
13297
|
-
const {format} = require$$0$1;
|
|
13297
|
+
const { format } = require$$0$1;
|
|
13298
13298
|
const { constants: constants$4 } = errorConstants$1;
|
|
13299
13299
|
|
|
13300
13300
|
/**
|
|
@@ -13314,7 +13314,7 @@
|
|
|
13314
13314
|
} else {
|
|
13315
13315
|
/* istanbul ignore next */
|
|
13316
13316
|
nextTick$1(function () {
|
|
13317
|
-
console.warn(type +
|
|
13317
|
+
console.warn(type + ": " + msg);
|
|
13318
13318
|
});
|
|
13319
13319
|
}
|
|
13320
13320
|
};
|
|
@@ -13326,11 +13326,11 @@
|
|
|
13326
13326
|
* @param {string} [msg] - Warning to print
|
|
13327
13327
|
* @private
|
|
13328
13328
|
*/
|
|
13329
|
-
const deprecate = msg => {
|
|
13329
|
+
const deprecate = (msg) => {
|
|
13330
13330
|
msg = String(msg);
|
|
13331
13331
|
if (msg && !deprecate.cache[msg]) {
|
|
13332
13332
|
deprecate.cache[msg] = true;
|
|
13333
|
-
emitWarning(msg,
|
|
13333
|
+
emitWarning(msg, "DeprecationWarning");
|
|
13334
13334
|
}
|
|
13335
13335
|
};
|
|
13336
13336
|
deprecate.cache = {};
|
|
@@ -13342,7 +13342,7 @@
|
|
|
13342
13342
|
* @param {string} [msg] - Warning to print
|
|
13343
13343
|
* @private
|
|
13344
13344
|
*/
|
|
13345
|
-
const warn = msg => {
|
|
13345
|
+
const warn = (msg) => {
|
|
13346
13346
|
if (msg) {
|
|
13347
13347
|
emitWarning(msg);
|
|
13348
13348
|
}
|
|
@@ -13464,7 +13464,7 @@
|
|
|
13464
13464
|
err.code = constants$4.INVALID_ARG_VALUE;
|
|
13465
13465
|
err.argument = argument;
|
|
13466
13466
|
err.value = value;
|
|
13467
|
-
err.reason = typeof reason !==
|
|
13467
|
+
err.reason = typeof reason !== "undefined" ? reason : "is invalid";
|
|
13468
13468
|
return err;
|
|
13469
13469
|
}
|
|
13470
13470
|
|
|
@@ -13512,9 +13512,9 @@
|
|
|
13512
13512
|
*/
|
|
13513
13513
|
function createInvalidLegacyPluginError(message, pluginType, pluginId) {
|
|
13514
13514
|
switch (pluginType) {
|
|
13515
|
-
case
|
|
13515
|
+
case "reporter":
|
|
13516
13516
|
return createInvalidReporterError(message, pluginId);
|
|
13517
|
-
case
|
|
13517
|
+
case "ui":
|
|
13518
13518
|
return createInvalidInterfaceError(message, pluginId);
|
|
13519
13519
|
default:
|
|
13520
13520
|
throw new Error('unknown pluginType "' + pluginType + '"');
|
|
@@ -13533,7 +13533,7 @@
|
|
|
13533
13533
|
* @returns {Error}
|
|
13534
13534
|
*/
|
|
13535
13535
|
function createInvalidPluginError(...args) {
|
|
13536
|
-
deprecate(
|
|
13536
|
+
deprecate("Use createInvalidLegacyPluginError() instead");
|
|
13537
13537
|
return createInvalidLegacyPluginError(...args);
|
|
13538
13538
|
}
|
|
13539
13539
|
|
|
@@ -13547,7 +13547,7 @@
|
|
|
13547
13547
|
function createMochaInstanceAlreadyDisposedError(
|
|
13548
13548
|
message,
|
|
13549
13549
|
cleanReferencesAfterRun,
|
|
13550
|
-
instance
|
|
13550
|
+
instance,
|
|
13551
13551
|
) {
|
|
13552
13552
|
var err = new Error(message);
|
|
13553
13553
|
err.code = constants$4.INSTANCE_ALREADY_DISPOSED;
|
|
@@ -13581,23 +13581,23 @@
|
|
|
13581
13581
|
function createMultipleDoneError$1(runnable, originalErr) {
|
|
13582
13582
|
var title;
|
|
13583
13583
|
try {
|
|
13584
|
-
title = format(
|
|
13584
|
+
title = format("<%s>", runnable.fullTitle());
|
|
13585
13585
|
if (runnable.parent.root) {
|
|
13586
|
-
title +=
|
|
13586
|
+
title += " (of root suite)";
|
|
13587
13587
|
}
|
|
13588
13588
|
} catch (ignored) {
|
|
13589
|
-
title = format(
|
|
13589
|
+
title = format("<%s> (of unknown suite)", runnable.title);
|
|
13590
13590
|
}
|
|
13591
13591
|
var message = format(
|
|
13592
|
-
|
|
13593
|
-
runnable.type ? runnable.type :
|
|
13594
|
-
title
|
|
13592
|
+
"done() called multiple times in %s %s",
|
|
13593
|
+
runnable.type ? runnable.type : "unknown runnable",
|
|
13594
|
+
title,
|
|
13595
13595
|
);
|
|
13596
13596
|
if (runnable.file) {
|
|
13597
|
-
message += format(
|
|
13597
|
+
message += format(" of file %s", runnable.file);
|
|
13598
13598
|
}
|
|
13599
13599
|
if (originalErr) {
|
|
13600
|
-
message += format(
|
|
13600
|
+
message += format("; in addition, done() received error: %s", originalErr);
|
|
13601
13601
|
}
|
|
13602
13602
|
|
|
13603
13603
|
var err = new Error(message);
|
|
@@ -13618,8 +13618,8 @@
|
|
|
13618
13618
|
function createForbiddenExclusivityError$1(mocha) {
|
|
13619
13619
|
var err = new Error(
|
|
13620
13620
|
mocha.isWorker
|
|
13621
|
-
?
|
|
13622
|
-
:
|
|
13621
|
+
? "`.only` is not supported in parallel mode"
|
|
13622
|
+
: "`.only` forbidden by --forbid-only",
|
|
13623
13623
|
);
|
|
13624
13624
|
err.code = constants$4.FORBIDDEN_EXCLUSIVITY;
|
|
13625
13625
|
return err;
|
|
@@ -13652,7 +13652,7 @@
|
|
|
13652
13652
|
*/
|
|
13653
13653
|
function createInvalidPluginImplementationError(
|
|
13654
13654
|
msg,
|
|
13655
|
-
{pluginDef, pluginImpl} = {}
|
|
13655
|
+
{ pluginDef, pluginImpl } = {},
|
|
13656
13656
|
) {
|
|
13657
13657
|
const err = new Error(msg);
|
|
13658
13658
|
err.code = constants$4.INVALID_PLUGIN_IMPLEMENTATION;
|
|
@@ -13698,8 +13698,8 @@
|
|
|
13698
13698
|
* @param {*} err - Error, or anything
|
|
13699
13699
|
* @returns {boolean}
|
|
13700
13700
|
*/
|
|
13701
|
-
const isMochaError$1 = err =>
|
|
13702
|
-
Boolean(err && typeof err ===
|
|
13701
|
+
const isMochaError$1 = (err) =>
|
|
13702
|
+
Boolean(err && typeof err === "object" && MOCHA_ERRORS.has(err.code));
|
|
13703
13703
|
|
|
13704
13704
|
var errors$2 = {
|
|
13705
13705
|
createFatalError: createFatalError$1,
|
|
@@ -13723,18 +13723,18 @@
|
|
|
13723
13723
|
createUnsupportedError: createUnsupportedError$2,
|
|
13724
13724
|
deprecate,
|
|
13725
13725
|
isMochaError: isMochaError$1,
|
|
13726
|
-
warn
|
|
13726
|
+
warn,
|
|
13727
13727
|
};
|
|
13728
13728
|
|
|
13729
13729
|
var EventEmitter$1 = require$$0.EventEmitter;
|
|
13730
13730
|
var Pending$1 = pending;
|
|
13731
|
-
var debug$1 = browser.exports(
|
|
13731
|
+
var debug$1 = browser.exports("mocha:runnable");
|
|
13732
13732
|
var milliseconds = ms$1;
|
|
13733
13733
|
var utils$2 = utils$3;
|
|
13734
13734
|
const {
|
|
13735
13735
|
createInvalidExceptionError: createInvalidExceptionError$1,
|
|
13736
13736
|
createMultipleDoneError,
|
|
13737
|
-
createTimeoutError
|
|
13737
|
+
createTimeoutError,
|
|
13738
13738
|
} = errors$2;
|
|
13739
13739
|
|
|
13740
13740
|
/**
|
|
@@ -13764,17 +13764,17 @@
|
|
|
13764
13764
|
function Runnable$3(title, fn) {
|
|
13765
13765
|
this.title = title;
|
|
13766
13766
|
this.fn = fn;
|
|
13767
|
-
this.body = (fn ||
|
|
13767
|
+
this.body = (fn || "").toString();
|
|
13768
13768
|
this.async = fn && fn.length;
|
|
13769
13769
|
this.sync = !this.async;
|
|
13770
13770
|
this._timeout = 2000;
|
|
13771
13771
|
this._slow = 75;
|
|
13772
13772
|
this._retries = -1;
|
|
13773
13773
|
utils$2.assignNewMochaID(this);
|
|
13774
|
-
Object.defineProperty(this,
|
|
13774
|
+
Object.defineProperty(this, "id", {
|
|
13775
13775
|
get() {
|
|
13776
13776
|
return utils$2.getMochaID(this);
|
|
13777
|
-
}
|
|
13777
|
+
},
|
|
13778
13778
|
});
|
|
13779
13779
|
this.reset();
|
|
13780
13780
|
}
|
|
@@ -13820,7 +13820,7 @@
|
|
|
13820
13820
|
if (!arguments.length) {
|
|
13821
13821
|
return this._timeout;
|
|
13822
13822
|
}
|
|
13823
|
-
if (typeof ms ===
|
|
13823
|
+
if (typeof ms === "string") {
|
|
13824
13824
|
ms = milliseconds(ms);
|
|
13825
13825
|
}
|
|
13826
13826
|
|
|
@@ -13834,7 +13834,7 @@
|
|
|
13834
13834
|
} else {
|
|
13835
13835
|
this._timeout = ms;
|
|
13836
13836
|
}
|
|
13837
|
-
debug$1(
|
|
13837
|
+
debug$1("timeout %d", this._timeout);
|
|
13838
13838
|
|
|
13839
13839
|
if (this.timer) {
|
|
13840
13840
|
this.resetTimeout();
|
|
@@ -13850,13 +13850,13 @@
|
|
|
13850
13850
|
* @return {Runnable|number} ms or Runnable instance.
|
|
13851
13851
|
*/
|
|
13852
13852
|
Runnable$3.prototype.slow = function (ms) {
|
|
13853
|
-
if (!arguments.length || typeof ms ===
|
|
13853
|
+
if (!arguments.length || typeof ms === "undefined") {
|
|
13854
13854
|
return this._slow;
|
|
13855
13855
|
}
|
|
13856
|
-
if (typeof ms ===
|
|
13856
|
+
if (typeof ms === "string") {
|
|
13857
13857
|
ms = milliseconds(ms);
|
|
13858
13858
|
}
|
|
13859
|
-
debug$1(
|
|
13859
|
+
debug$1("slow %d", ms);
|
|
13860
13860
|
this._slow = ms;
|
|
13861
13861
|
return this;
|
|
13862
13862
|
};
|
|
@@ -13869,7 +13869,7 @@
|
|
|
13869
13869
|
*/
|
|
13870
13870
|
Runnable$3.prototype.skip = function () {
|
|
13871
13871
|
this.pending = true;
|
|
13872
|
-
throw new Pending$1(
|
|
13872
|
+
throw new Pending$1("sync skip; aborting execution");
|
|
13873
13873
|
};
|
|
13874
13874
|
|
|
13875
13875
|
/**
|
|
@@ -13932,7 +13932,7 @@
|
|
|
13932
13932
|
* @return {string}
|
|
13933
13933
|
*/
|
|
13934
13934
|
Runnable$3.prototype.fullTitle = function () {
|
|
13935
|
-
return this.titlePath().join(
|
|
13935
|
+
return this.titlePath().join(" ");
|
|
13936
13936
|
};
|
|
13937
13937
|
|
|
13938
13938
|
/**
|
|
@@ -14013,7 +14013,7 @@
|
|
|
14013
14013
|
return;
|
|
14014
14014
|
}
|
|
14015
14015
|
errorWasHandled = true;
|
|
14016
|
-
self.emit(
|
|
14016
|
+
self.emit("error", createMultipleDoneError(self, err));
|
|
14017
14017
|
}
|
|
14018
14018
|
|
|
14019
14019
|
// finished
|
|
@@ -14039,11 +14039,11 @@
|
|
|
14039
14039
|
// for .resetTimeout() and Runner#uncaught()
|
|
14040
14040
|
this.callback = done;
|
|
14041
14041
|
|
|
14042
|
-
if (this.fn && typeof this.fn.call !==
|
|
14042
|
+
if (this.fn && typeof this.fn.call !== "function") {
|
|
14043
14043
|
done(
|
|
14044
14044
|
new TypeError(
|
|
14045
|
-
|
|
14046
|
-
)
|
|
14045
|
+
"A runnable must be passed a function as its second argument.",
|
|
14046
|
+
),
|
|
14047
14047
|
);
|
|
14048
14048
|
return;
|
|
14049
14049
|
}
|
|
@@ -14057,7 +14057,7 @@
|
|
|
14057
14057
|
this.pending = true;
|
|
14058
14058
|
done();
|
|
14059
14059
|
// halt execution, the uncaught handler will ignore the failure.
|
|
14060
|
-
throw new Pending$1(
|
|
14060
|
+
throw new Pending$1("async skip; aborting execution");
|
|
14061
14061
|
};
|
|
14062
14062
|
|
|
14063
14063
|
try {
|
|
@@ -14090,7 +14090,7 @@
|
|
|
14090
14090
|
|
|
14091
14091
|
function callFn(fn) {
|
|
14092
14092
|
var result = fn.call(ctx);
|
|
14093
|
-
if (result && typeof result.then ===
|
|
14093
|
+
if (result && typeof result.then === "function") {
|
|
14094
14094
|
self.resetTimeout();
|
|
14095
14095
|
result.then(
|
|
14096
14096
|
function () {
|
|
@@ -14100,15 +14100,15 @@
|
|
|
14100
14100
|
return null;
|
|
14101
14101
|
},
|
|
14102
14102
|
function (reason) {
|
|
14103
|
-
done(reason || new Error(
|
|
14104
|
-
}
|
|
14103
|
+
done(reason || new Error("Promise rejected with no or falsy reason"));
|
|
14104
|
+
},
|
|
14105
14105
|
);
|
|
14106
14106
|
} else {
|
|
14107
14107
|
if (self.asyncOnly) {
|
|
14108
14108
|
return done(
|
|
14109
14109
|
new Error(
|
|
14110
|
-
|
|
14111
|
-
)
|
|
14110
|
+
"--async-only option in use without declaring `done()` or returning a promise",
|
|
14111
|
+
),
|
|
14112
14112
|
);
|
|
14113
14113
|
}
|
|
14114
14114
|
|
|
@@ -14118,22 +14118,22 @@
|
|
|
14118
14118
|
|
|
14119
14119
|
function callFnAsync(fn) {
|
|
14120
14120
|
var result = fn.call(ctx, function (err) {
|
|
14121
|
-
if (err instanceof Error || toString.call(err) ===
|
|
14121
|
+
if (err instanceof Error || toString.call(err) === "[object Error]") {
|
|
14122
14122
|
return done(err);
|
|
14123
14123
|
}
|
|
14124
14124
|
if (err) {
|
|
14125
|
-
if (Object.prototype.toString.call(err) ===
|
|
14125
|
+
if (Object.prototype.toString.call(err) === "[object Object]") {
|
|
14126
14126
|
return done(
|
|
14127
|
-
new Error(
|
|
14127
|
+
new Error("done() invoked with non-Error: " + JSON.stringify(err)),
|
|
14128
14128
|
);
|
|
14129
14129
|
}
|
|
14130
|
-
return done(new Error(
|
|
14130
|
+
return done(new Error("done() invoked with non-Error: " + err));
|
|
14131
14131
|
}
|
|
14132
14132
|
if (result && utils$2.isPromise(result)) {
|
|
14133
14133
|
return done(
|
|
14134
14134
|
new Error(
|
|
14135
|
-
|
|
14136
|
-
)
|
|
14135
|
+
"Resolution method is overspecified. Specify a callback *or* return a Promise; not both.",
|
|
14136
|
+
),
|
|
14137
14137
|
);
|
|
14138
14138
|
}
|
|
14139
14139
|
|
|
@@ -14152,7 +14152,7 @@
|
|
|
14152
14152
|
Runnable$3.prototype._timeoutError = function (ms) {
|
|
14153
14153
|
let msg = `Timeout of ${ms}ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.`;
|
|
14154
14154
|
if (this.file) {
|
|
14155
|
-
msg +=
|
|
14155
|
+
msg += " (" + this.file + ")";
|
|
14156
14156
|
}
|
|
14157
14157
|
return createTimeoutError(msg, ms, this.file);
|
|
14158
14158
|
};
|
|
@@ -14171,16 +14171,16 @@
|
|
|
14171
14171
|
/**
|
|
14172
14172
|
* Value of `state` prop when a `Runnable` has failed
|
|
14173
14173
|
*/
|
|
14174
|
-
STATE_FAILED:
|
|
14174
|
+
STATE_FAILED: "failed",
|
|
14175
14175
|
/**
|
|
14176
14176
|
* Value of `state` prop when a `Runnable` has passed
|
|
14177
14177
|
*/
|
|
14178
|
-
STATE_PASSED:
|
|
14178
|
+
STATE_PASSED: "passed",
|
|
14179
14179
|
/**
|
|
14180
14180
|
* Value of `state` prop when a `Runnable` has been skipped by user
|
|
14181
14181
|
*/
|
|
14182
|
-
STATE_PENDING:
|
|
14183
|
-
}
|
|
14182
|
+
STATE_PENDING: "pending",
|
|
14183
|
+
},
|
|
14184
14184
|
);
|
|
14185
14185
|
|
|
14186
14186
|
/**
|
|
@@ -14193,8 +14193,8 @@
|
|
|
14193
14193
|
return (
|
|
14194
14194
|
value ||
|
|
14195
14195
|
createInvalidExceptionError$1(
|
|
14196
|
-
|
|
14197
|
-
value
|
|
14196
|
+
"Runnable failed with falsy or undefined exception. Please throw an Error instead.",
|
|
14197
|
+
value,
|
|
14198
14198
|
)
|
|
14199
14199
|
);
|
|
14200
14200
|
};
|
|
@@ -14204,8 +14204,8 @@
|
|
|
14204
14204
|
var suite = {exports: {}};
|
|
14205
14205
|
|
|
14206
14206
|
var Runnable$2 = runnable;
|
|
14207
|
-
const {inherits, constants: constants$2} = utils$3;
|
|
14208
|
-
const {MOCHA_ID_PROP_NAME: MOCHA_ID_PROP_NAME$1} = constants$2;
|
|
14207
|
+
const { inherits, constants: constants$2 } = utils$3;
|
|
14208
|
+
const { MOCHA_ID_PROP_NAME: MOCHA_ID_PROP_NAME$1 } = constants$2;
|
|
14209
14209
|
|
|
14210
14210
|
/**
|
|
14211
14211
|
* Expose `Hook`.
|
|
@@ -14223,7 +14223,7 @@
|
|
|
14223
14223
|
*/
|
|
14224
14224
|
function Hook(title, fn) {
|
|
14225
14225
|
Runnable$2.call(this, title, fn);
|
|
14226
|
-
this.type =
|
|
14226
|
+
this.type = "hook";
|
|
14227
14227
|
}
|
|
14228
14228
|
|
|
14229
14229
|
/**
|
|
@@ -14274,20 +14274,20 @@
|
|
|
14274
14274
|
? {
|
|
14275
14275
|
currentTest: {
|
|
14276
14276
|
title: this.ctx.currentTest.title,
|
|
14277
|
-
[MOCHA_ID_PROP_NAME$1]: this.ctx.currentTest.id
|
|
14278
|
-
}
|
|
14277
|
+
[MOCHA_ID_PROP_NAME$1]: this.ctx.currentTest.id,
|
|
14278
|
+
},
|
|
14279
14279
|
}
|
|
14280
14280
|
: {},
|
|
14281
14281
|
duration: this.duration,
|
|
14282
14282
|
file: this.file,
|
|
14283
14283
|
parent: {
|
|
14284
14284
|
$$fullTitle: this.parent.fullTitle(),
|
|
14285
|
-
[MOCHA_ID_PROP_NAME$1]: this.parent.id
|
|
14285
|
+
[MOCHA_ID_PROP_NAME$1]: this.parent.id,
|
|
14286
14286
|
},
|
|
14287
14287
|
state: this.state,
|
|
14288
14288
|
title: this.title,
|
|
14289
14289
|
type: this.type,
|
|
14290
|
-
[MOCHA_ID_PROP_NAME$1]: this.id
|
|
14290
|
+
[MOCHA_ID_PROP_NAME$1]: this.id,
|
|
14291
14291
|
};
|
|
14292
14292
|
};
|
|
14293
14293
|
|
|
@@ -14301,7 +14301,7 @@
|
|
|
14301
14301
|
* Module dependencies.
|
|
14302
14302
|
* @private
|
|
14303
14303
|
*/
|
|
14304
|
-
const {EventEmitter} = require$$0;
|
|
14304
|
+
const { EventEmitter } = require$$0;
|
|
14305
14305
|
const Hook = hook;
|
|
14306
14306
|
var {
|
|
14307
14307
|
assignNewMochaID,
|
|
@@ -14310,13 +14310,13 @@
|
|
|
14310
14310
|
defineConstants,
|
|
14311
14311
|
getMochaID,
|
|
14312
14312
|
inherits,
|
|
14313
|
-
isString
|
|
14313
|
+
isString,
|
|
14314
14314
|
} = utils$3;
|
|
14315
|
-
const debug = browser.exports(
|
|
14315
|
+
const debug = browser.exports("mocha:suite");
|
|
14316
14316
|
const milliseconds = ms$1;
|
|
14317
14317
|
const errors = errors$2;
|
|
14318
14318
|
|
|
14319
|
-
const {MOCHA_ID_PROP_NAME} = utilsConstants;
|
|
14319
|
+
const { MOCHA_ID_PROP_NAME } = utilsConstants;
|
|
14320
14320
|
|
|
14321
14321
|
/**
|
|
14322
14322
|
* Expose `Suite`.
|
|
@@ -14357,8 +14357,8 @@
|
|
|
14357
14357
|
'Suite argument "title" must be a string. Received type "' +
|
|
14358
14358
|
typeof title +
|
|
14359
14359
|
'"',
|
|
14360
|
-
|
|
14361
|
-
|
|
14360
|
+
"title",
|
|
14361
|
+
"string",
|
|
14362
14362
|
);
|
|
14363
14363
|
}
|
|
14364
14364
|
this.title = title;
|
|
@@ -14381,10 +14381,10 @@
|
|
|
14381
14381
|
this._onlySuites = [];
|
|
14382
14382
|
assignNewMochaID(this);
|
|
14383
14383
|
|
|
14384
|
-
Object.defineProperty(this,
|
|
14384
|
+
Object.defineProperty(this, "id", {
|
|
14385
14385
|
get() {
|
|
14386
14386
|
return getMochaID(this);
|
|
14387
|
-
}
|
|
14387
|
+
},
|
|
14388
14388
|
});
|
|
14389
14389
|
|
|
14390
14390
|
this.reset();
|
|
@@ -14419,7 +14419,7 @@
|
|
|
14419
14419
|
*/
|
|
14420
14420
|
Suite.prototype.clone = function () {
|
|
14421
14421
|
var suite = new Suite(this.title);
|
|
14422
|
-
debug(
|
|
14422
|
+
debug("clone");
|
|
14423
14423
|
suite.ctx = this.ctx;
|
|
14424
14424
|
suite.root = this.root;
|
|
14425
14425
|
suite.timeout(this.timeout());
|
|
@@ -14441,7 +14441,7 @@
|
|
|
14441
14441
|
if (!arguments.length) {
|
|
14442
14442
|
return this._timeout;
|
|
14443
14443
|
}
|
|
14444
|
-
if (typeof ms ===
|
|
14444
|
+
if (typeof ms === "string") {
|
|
14445
14445
|
ms = milliseconds(ms);
|
|
14446
14446
|
}
|
|
14447
14447
|
|
|
@@ -14450,8 +14450,18 @@
|
|
|
14450
14450
|
var range = [0, INT_MAX];
|
|
14451
14451
|
ms = clamp(ms, range);
|
|
14452
14452
|
|
|
14453
|
-
debug(
|
|
14453
|
+
debug("timeout %d", ms);
|
|
14454
14454
|
this._timeout = parseInt(ms, 10);
|
|
14455
|
+
|
|
14456
|
+
// Allow overriding inner/nested suites
|
|
14457
|
+
// See and test-cases with chain-called timeout argument.
|
|
14458
|
+
// https://github.com/mochajs/mocha/issues/5422
|
|
14459
|
+
for (const t of this.tests) {
|
|
14460
|
+
t.timeout(this._timeout);
|
|
14461
|
+
}
|
|
14462
|
+
for (const s of this.suites) {
|
|
14463
|
+
s.timeout(this._timeout);
|
|
14464
|
+
}
|
|
14455
14465
|
return this;
|
|
14456
14466
|
};
|
|
14457
14467
|
|
|
@@ -14466,7 +14476,7 @@
|
|
|
14466
14476
|
if (!arguments.length) {
|
|
14467
14477
|
return this._retries;
|
|
14468
14478
|
}
|
|
14469
|
-
debug(
|
|
14479
|
+
debug("retries %d", n);
|
|
14470
14480
|
this._retries = parseInt(n, 10) || 0;
|
|
14471
14481
|
return this;
|
|
14472
14482
|
};
|
|
@@ -14482,10 +14492,10 @@
|
|
|
14482
14492
|
if (!arguments.length) {
|
|
14483
14493
|
return this._slow;
|
|
14484
14494
|
}
|
|
14485
|
-
if (typeof ms ===
|
|
14495
|
+
if (typeof ms === "string") {
|
|
14486
14496
|
ms = milliseconds(ms);
|
|
14487
14497
|
}
|
|
14488
|
-
debug(
|
|
14498
|
+
debug("slow %d", ms);
|
|
14489
14499
|
this._slow = ms;
|
|
14490
14500
|
return this;
|
|
14491
14501
|
};
|
|
@@ -14501,7 +14511,7 @@
|
|
|
14501
14511
|
if (!arguments.length) {
|
|
14502
14512
|
return this._bail;
|
|
14503
14513
|
}
|
|
14504
|
-
debug(
|
|
14514
|
+
debug("bail %s", bail);
|
|
14505
14515
|
this._bail = bail;
|
|
14506
14516
|
return this;
|
|
14507
14517
|
};
|
|
@@ -14545,11 +14555,11 @@
|
|
|
14545
14555
|
if (this.isPending()) {
|
|
14546
14556
|
return this;
|
|
14547
14557
|
}
|
|
14548
|
-
if (typeof title ===
|
|
14558
|
+
if (typeof title === "function") {
|
|
14549
14559
|
fn = title;
|
|
14550
14560
|
title = fn.name;
|
|
14551
14561
|
}
|
|
14552
|
-
title = '"before all" hook' + (title ?
|
|
14562
|
+
title = '"before all" hook' + (title ? ": " + title : "");
|
|
14553
14563
|
|
|
14554
14564
|
var hook = this._createHook(title, fn);
|
|
14555
14565
|
this._beforeAll.push(hook);
|
|
@@ -14569,11 +14579,11 @@
|
|
|
14569
14579
|
if (this.isPending()) {
|
|
14570
14580
|
return this;
|
|
14571
14581
|
}
|
|
14572
|
-
if (typeof title ===
|
|
14582
|
+
if (typeof title === "function") {
|
|
14573
14583
|
fn = title;
|
|
14574
14584
|
title = fn.name;
|
|
14575
14585
|
}
|
|
14576
|
-
title = '"after all" hook' + (title ?
|
|
14586
|
+
title = '"after all" hook' + (title ? ": " + title : "");
|
|
14577
14587
|
|
|
14578
14588
|
var hook = this._createHook(title, fn);
|
|
14579
14589
|
this._afterAll.push(hook);
|
|
@@ -14593,11 +14603,11 @@
|
|
|
14593
14603
|
if (this.isPending()) {
|
|
14594
14604
|
return this;
|
|
14595
14605
|
}
|
|
14596
|
-
if (typeof title ===
|
|
14606
|
+
if (typeof title === "function") {
|
|
14597
14607
|
fn = title;
|
|
14598
14608
|
title = fn.name;
|
|
14599
14609
|
}
|
|
14600
|
-
title = '"before each" hook' + (title ?
|
|
14610
|
+
title = '"before each" hook' + (title ? ": " + title : "");
|
|
14601
14611
|
|
|
14602
14612
|
var hook = this._createHook(title, fn);
|
|
14603
14613
|
this._beforeEach.push(hook);
|
|
@@ -14617,11 +14627,11 @@
|
|
|
14617
14627
|
if (this.isPending()) {
|
|
14618
14628
|
return this;
|
|
14619
14629
|
}
|
|
14620
|
-
if (typeof title ===
|
|
14630
|
+
if (typeof title === "function") {
|
|
14621
14631
|
fn = title;
|
|
14622
14632
|
title = fn.name;
|
|
14623
14633
|
}
|
|
14624
|
-
title = '"after each" hook' + (title ?
|
|
14634
|
+
title = '"after each" hook' + (title ? ": " + title : "");
|
|
14625
14635
|
|
|
14626
14636
|
var hook = this._createHook(title, fn);
|
|
14627
14637
|
this._afterEach.push(hook);
|
|
@@ -14675,7 +14685,7 @@
|
|
|
14675
14685
|
* @return {string}
|
|
14676
14686
|
*/
|
|
14677
14687
|
Suite.prototype.fullTitle = function () {
|
|
14678
|
-
return this.titlePath().join(
|
|
14688
|
+
return this.titlePath().join(" ");
|
|
14679
14689
|
};
|
|
14680
14690
|
|
|
14681
14691
|
/**
|
|
@@ -14819,7 +14829,7 @@
|
|
|
14819
14829
|
* @private
|
|
14820
14830
|
*/
|
|
14821
14831
|
Suite.prototype.getHooks = function getHooks(name) {
|
|
14822
|
-
return this[
|
|
14832
|
+
return this["_" + name];
|
|
14823
14833
|
};
|
|
14824
14834
|
|
|
14825
14835
|
/**
|
|
@@ -14884,7 +14894,7 @@
|
|
|
14884
14894
|
root: this.root,
|
|
14885
14895
|
title: this.title,
|
|
14886
14896
|
[MOCHA_ID_PROP_NAME]: this.id,
|
|
14887
|
-
parent: this.parent ? {[MOCHA_ID_PROP_NAME]: this.parent.id} : null
|
|
14897
|
+
parent: this.parent ? { [MOCHA_ID_PROP_NAME]: this.parent.id } : null,
|
|
14888
14898
|
};
|
|
14889
14899
|
};
|
|
14890
14900
|
|
|
@@ -14902,62 +14912,62 @@
|
|
|
14902
14912
|
/**
|
|
14903
14913
|
* Event emitted after a test file has been loaded. Not emitted in browser.
|
|
14904
14914
|
*/
|
|
14905
|
-
EVENT_FILE_POST_REQUIRE:
|
|
14915
|
+
EVENT_FILE_POST_REQUIRE: "post-require",
|
|
14906
14916
|
/**
|
|
14907
14917
|
* Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
|
|
14908
14918
|
*/
|
|
14909
|
-
EVENT_FILE_PRE_REQUIRE:
|
|
14919
|
+
EVENT_FILE_PRE_REQUIRE: "pre-require",
|
|
14910
14920
|
/**
|
|
14911
14921
|
* Event emitted immediately after a test file has been loaded. Not emitted in browser.
|
|
14912
14922
|
*/
|
|
14913
|
-
EVENT_FILE_REQUIRE:
|
|
14923
|
+
EVENT_FILE_REQUIRE: "require",
|
|
14914
14924
|
/**
|
|
14915
14925
|
* Event emitted when `global.run()` is called (use with `delay` option).
|
|
14916
14926
|
*/
|
|
14917
|
-
EVENT_ROOT_SUITE_RUN:
|
|
14927
|
+
EVENT_ROOT_SUITE_RUN: "run",
|
|
14918
14928
|
|
|
14919
14929
|
/**
|
|
14920
14930
|
* Namespace for collection of a `Suite`'s "after all" hooks.
|
|
14921
14931
|
*/
|
|
14922
|
-
HOOK_TYPE_AFTER_ALL:
|
|
14932
|
+
HOOK_TYPE_AFTER_ALL: "afterAll",
|
|
14923
14933
|
/**
|
|
14924
14934
|
* Namespace for collection of a `Suite`'s "after each" hooks.
|
|
14925
14935
|
*/
|
|
14926
|
-
HOOK_TYPE_AFTER_EACH:
|
|
14936
|
+
HOOK_TYPE_AFTER_EACH: "afterEach",
|
|
14927
14937
|
/**
|
|
14928
14938
|
* Namespace for collection of a `Suite`'s "before all" hooks.
|
|
14929
14939
|
*/
|
|
14930
|
-
HOOK_TYPE_BEFORE_ALL:
|
|
14940
|
+
HOOK_TYPE_BEFORE_ALL: "beforeAll",
|
|
14931
14941
|
/**
|
|
14932
14942
|
* Namespace for collection of a `Suite`'s "before each" hooks.
|
|
14933
14943
|
*/
|
|
14934
|
-
HOOK_TYPE_BEFORE_EACH:
|
|
14944
|
+
HOOK_TYPE_BEFORE_EACH: "beforeEach",
|
|
14935
14945
|
|
|
14936
14946
|
/**
|
|
14937
14947
|
* Emitted after a child `Suite` has been added to a `Suite`.
|
|
14938
14948
|
*/
|
|
14939
|
-
EVENT_SUITE_ADD_SUITE:
|
|
14949
|
+
EVENT_SUITE_ADD_SUITE: "suite",
|
|
14940
14950
|
/**
|
|
14941
14951
|
* Emitted after an "after all" `Hook` has been added to a `Suite`.
|
|
14942
14952
|
*/
|
|
14943
|
-
EVENT_SUITE_ADD_HOOK_AFTER_ALL:
|
|
14953
|
+
EVENT_SUITE_ADD_HOOK_AFTER_ALL: "afterAll",
|
|
14944
14954
|
/**
|
|
14945
14955
|
* Emitted after an "after each" `Hook` has been added to a `Suite`.
|
|
14946
14956
|
*/
|
|
14947
|
-
EVENT_SUITE_ADD_HOOK_AFTER_EACH:
|
|
14957
|
+
EVENT_SUITE_ADD_HOOK_AFTER_EACH: "afterEach",
|
|
14948
14958
|
/**
|
|
14949
14959
|
* Emitted after an "before all" `Hook` has been added to a `Suite`.
|
|
14950
14960
|
*/
|
|
14951
|
-
EVENT_SUITE_ADD_HOOK_BEFORE_ALL:
|
|
14961
|
+
EVENT_SUITE_ADD_HOOK_BEFORE_ALL: "beforeAll",
|
|
14952
14962
|
/**
|
|
14953
14963
|
* Emitted after an "before each" `Hook` has been added to a `Suite`.
|
|
14954
14964
|
*/
|
|
14955
|
-
EVENT_SUITE_ADD_HOOK_BEFORE_EACH:
|
|
14965
|
+
EVENT_SUITE_ADD_HOOK_BEFORE_EACH: "beforeEach",
|
|
14956
14966
|
/**
|
|
14957
14967
|
* Emitted after a `Test` has been added to a `Suite`.
|
|
14958
14968
|
*/
|
|
14959
|
-
EVENT_SUITE_ADD_TEST:
|
|
14960
|
-
}
|
|
14969
|
+
EVENT_SUITE_ADD_TEST: "test",
|
|
14970
|
+
},
|
|
14961
14971
|
);
|
|
14962
14972
|
|
|
14963
14973
|
Suite.constants = constants;
|
|
@@ -14974,7 +14984,7 @@
|
|
|
14974
14984
|
var EventEmitter = require$$0.EventEmitter;
|
|
14975
14985
|
var Pending = pending;
|
|
14976
14986
|
var utils$1 = utils$3;
|
|
14977
|
-
var debug = browser.exports(
|
|
14987
|
+
var debug = browser.exports("mocha:runner");
|
|
14978
14988
|
var Runnable$1 = runnable;
|
|
14979
14989
|
var Suite$2 = suite.exports;
|
|
14980
14990
|
var HOOK_TYPE_BEFORE_EACH = Suite$2.constants.HOOK_TYPE_BEFORE_EACH;
|
|
@@ -15002,14 +15012,14 @@
|
|
|
15002
15012
|
* @readonly
|
|
15003
15013
|
*/
|
|
15004
15014
|
var globals = [
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15015
|
+
"setTimeout",
|
|
15016
|
+
"clearTimeout",
|
|
15017
|
+
"setInterval",
|
|
15018
|
+
"clearInterval",
|
|
15019
|
+
"XMLHttpRequest",
|
|
15020
|
+
"Date",
|
|
15021
|
+
"setImmediate",
|
|
15022
|
+
"clearImmediate",
|
|
15013
15023
|
];
|
|
15014
15024
|
|
|
15015
15025
|
var constants$1 = utils$1.defineConstants(
|
|
@@ -15058,43 +15068,43 @@
|
|
|
15058
15068
|
/**
|
|
15059
15069
|
* Emitted when {@link Hook} execution begins
|
|
15060
15070
|
*/
|
|
15061
|
-
EVENT_HOOK_BEGIN:
|
|
15071
|
+
EVENT_HOOK_BEGIN: "hook",
|
|
15062
15072
|
/**
|
|
15063
15073
|
* Emitted when {@link Hook} execution ends
|
|
15064
15074
|
*/
|
|
15065
|
-
EVENT_HOOK_END:
|
|
15075
|
+
EVENT_HOOK_END: "hook end",
|
|
15066
15076
|
/**
|
|
15067
15077
|
* Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
|
|
15068
15078
|
*/
|
|
15069
|
-
EVENT_RUN_BEGIN:
|
|
15079
|
+
EVENT_RUN_BEGIN: "start",
|
|
15070
15080
|
/**
|
|
15071
15081
|
* Emitted when Root {@link Suite} execution has been delayed via `delay` option
|
|
15072
15082
|
*/
|
|
15073
|
-
EVENT_DELAY_BEGIN:
|
|
15083
|
+
EVENT_DELAY_BEGIN: "waiting",
|
|
15074
15084
|
/**
|
|
15075
15085
|
* Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
|
|
15076
15086
|
*/
|
|
15077
|
-
EVENT_DELAY_END:
|
|
15087
|
+
EVENT_DELAY_END: "ready",
|
|
15078
15088
|
/**
|
|
15079
15089
|
* Emitted when Root {@link Suite} execution ends
|
|
15080
15090
|
*/
|
|
15081
|
-
EVENT_RUN_END:
|
|
15091
|
+
EVENT_RUN_END: "end",
|
|
15082
15092
|
/**
|
|
15083
15093
|
* Emitted when {@link Suite} execution begins
|
|
15084
15094
|
*/
|
|
15085
|
-
EVENT_SUITE_BEGIN:
|
|
15095
|
+
EVENT_SUITE_BEGIN: "suite",
|
|
15086
15096
|
/**
|
|
15087
15097
|
* Emitted when {@link Suite} execution ends
|
|
15088
15098
|
*/
|
|
15089
|
-
EVENT_SUITE_END:
|
|
15099
|
+
EVENT_SUITE_END: "suite end",
|
|
15090
15100
|
/**
|
|
15091
15101
|
* Emitted when {@link Test} execution begins
|
|
15092
15102
|
*/
|
|
15093
|
-
EVENT_TEST_BEGIN:
|
|
15103
|
+
EVENT_TEST_BEGIN: "test",
|
|
15094
15104
|
/**
|
|
15095
15105
|
* Emitted when {@link Test} execution ends
|
|
15096
15106
|
*/
|
|
15097
|
-
EVENT_TEST_END:
|
|
15107
|
+
EVENT_TEST_END: "test end",
|
|
15098
15108
|
/**
|
|
15099
15109
|
* Emitted when {@link Test} execution fails. Includes an `err` object of type `Error`.
|
|
15100
15110
|
* @example
|
|
@@ -15104,32 +15114,32 @@
|
|
|
15104
15114
|
*
|
|
15105
15115
|
*
|
|
15106
15116
|
*/
|
|
15107
|
-
EVENT_TEST_FAIL:
|
|
15117
|
+
EVENT_TEST_FAIL: "fail",
|
|
15108
15118
|
/**
|
|
15109
15119
|
* Emitted when {@link Test} execution succeeds
|
|
15110
15120
|
*/
|
|
15111
|
-
EVENT_TEST_PASS:
|
|
15121
|
+
EVENT_TEST_PASS: "pass",
|
|
15112
15122
|
/**
|
|
15113
15123
|
* Emitted when {@link Test} becomes pending
|
|
15114
15124
|
*/
|
|
15115
|
-
EVENT_TEST_PENDING:
|
|
15125
|
+
EVENT_TEST_PENDING: "pending",
|
|
15116
15126
|
/**
|
|
15117
15127
|
* Emitted when {@link Test} execution has failed, but will retry
|
|
15118
15128
|
*/
|
|
15119
|
-
EVENT_TEST_RETRY:
|
|
15129
|
+
EVENT_TEST_RETRY: "retry",
|
|
15120
15130
|
/**
|
|
15121
15131
|
* Initial state of Runner
|
|
15122
15132
|
*/
|
|
15123
|
-
STATE_IDLE:
|
|
15133
|
+
STATE_IDLE: "idle",
|
|
15124
15134
|
/**
|
|
15125
15135
|
* State set to this value when the Runner has started running
|
|
15126
15136
|
*/
|
|
15127
|
-
STATE_RUNNING:
|
|
15137
|
+
STATE_RUNNING: "running",
|
|
15128
15138
|
/**
|
|
15129
15139
|
* State set to this value when the Runner has stopped
|
|
15130
15140
|
*/
|
|
15131
|
-
STATE_STOPPED:
|
|
15132
|
-
}
|
|
15141
|
+
STATE_STOPPED: "stopped",
|
|
15142
|
+
},
|
|
15133
15143
|
);
|
|
15134
15144
|
|
|
15135
15145
|
class Runner extends EventEmitter {
|
|
@@ -15162,7 +15172,7 @@
|
|
|
15162
15172
|
*/
|
|
15163
15173
|
this._eventListeners = new Map();
|
|
15164
15174
|
this.on(constants$1.EVENT_TEST_END, function (test) {
|
|
15165
|
-
if (test.type ===
|
|
15175
|
+
if (test.type === "test" && test.retriedTest() && test.parent) {
|
|
15166
15176
|
var idx =
|
|
15167
15177
|
test.parent.tests && test.parent.tests.indexOf(test.retriedTest());
|
|
15168
15178
|
if (idx > -1) test.parent.tests[idx] = test;
|
|
@@ -15180,23 +15190,23 @@
|
|
|
15180
15190
|
this.unhandled = (reason, promise) => {
|
|
15181
15191
|
if (isMochaError(reason)) {
|
|
15182
15192
|
debug(
|
|
15183
|
-
|
|
15184
|
-
reason
|
|
15193
|
+
"trapped unhandled rejection coming out of Mocha; forwarding to uncaught handler:",
|
|
15194
|
+
reason,
|
|
15185
15195
|
);
|
|
15186
15196
|
this.uncaught(reason);
|
|
15187
15197
|
} else {
|
|
15188
15198
|
debug(
|
|
15189
|
-
|
|
15199
|
+
"trapped unhandled rejection from (probably) user code; re-emitting on process",
|
|
15190
15200
|
);
|
|
15191
15201
|
this._removeEventListener(
|
|
15192
15202
|
process,
|
|
15193
|
-
|
|
15194
|
-
this.unhandled
|
|
15203
|
+
"unhandledRejection",
|
|
15204
|
+
this.unhandled,
|
|
15195
15205
|
);
|
|
15196
15206
|
try {
|
|
15197
|
-
process.emit(
|
|
15207
|
+
process.emit("unhandledRejection", reason, promise);
|
|
15198
15208
|
} finally {
|
|
15199
|
-
this._addEventListener(process,
|
|
15209
|
+
this._addEventListener(process, "unhandledRejection", this.unhandled);
|
|
15200
15210
|
}
|
|
15201
15211
|
}
|
|
15202
15212
|
};
|
|
@@ -15220,9 +15230,9 @@
|
|
|
15220
15230
|
*/
|
|
15221
15231
|
Runner.prototype._addEventListener = function (target, eventName, listener) {
|
|
15222
15232
|
debug(
|
|
15223
|
-
|
|
15233
|
+
"_addEventListener(): adding for event %s; %d current listeners",
|
|
15224
15234
|
eventName,
|
|
15225
|
-
target.listenerCount(eventName)
|
|
15235
|
+
target.listenerCount(eventName),
|
|
15226
15236
|
);
|
|
15227
15237
|
/* istanbul ignore next */
|
|
15228
15238
|
if (
|
|
@@ -15231,8 +15241,8 @@
|
|
|
15231
15241
|
this._eventListeners.get(target).get(eventName).has(listener)
|
|
15232
15242
|
) {
|
|
15233
15243
|
debug(
|
|
15234
|
-
|
|
15235
|
-
eventName
|
|
15244
|
+
"warning: tried to attach duplicate event listener for %s",
|
|
15245
|
+
eventName,
|
|
15236
15246
|
);
|
|
15237
15247
|
return;
|
|
15238
15248
|
}
|
|
@@ -15271,7 +15281,7 @@
|
|
|
15271
15281
|
this._eventListeners.delete(target);
|
|
15272
15282
|
}
|
|
15273
15283
|
} else {
|
|
15274
|
-
debug(
|
|
15284
|
+
debug("trying to remove listener for untracked object %s", target);
|
|
15275
15285
|
}
|
|
15276
15286
|
};
|
|
15277
15287
|
|
|
@@ -15283,7 +15293,7 @@
|
|
|
15283
15293
|
this.removeAllListeners();
|
|
15284
15294
|
this._eventListeners.forEach((targetListeners, target) => {
|
|
15285
15295
|
targetListeners.forEach((targetEventListeners, eventName) => {
|
|
15286
|
-
targetEventListeners.forEach(listener => {
|
|
15296
|
+
targetEventListeners.forEach((listener) => {
|
|
15287
15297
|
target.removeListener(eventName, listener);
|
|
15288
15298
|
});
|
|
15289
15299
|
});
|
|
@@ -15302,7 +15312,7 @@
|
|
|
15302
15312
|
* @return {Runner} Runner instance.
|
|
15303
15313
|
*/
|
|
15304
15314
|
Runner.prototype.grep = function (re, invert) {
|
|
15305
|
-
debug(
|
|
15315
|
+
debug("grep(): setting to %s", re);
|
|
15306
15316
|
this._grep = re;
|
|
15307
15317
|
this._invert = invert;
|
|
15308
15318
|
this.total = this.grepTotal(this.suite);
|
|
@@ -15367,7 +15377,7 @@
|
|
|
15367
15377
|
if (!arguments.length) {
|
|
15368
15378
|
return this._globals;
|
|
15369
15379
|
}
|
|
15370
|
-
debug(
|
|
15380
|
+
debug("globals(): setting to %O", arr);
|
|
15371
15381
|
this._globals = this._globals.concat(arr);
|
|
15372
15382
|
return this;
|
|
15373
15383
|
};
|
|
@@ -15399,7 +15409,7 @@
|
|
|
15399
15409
|
this._globals = this._globals.concat(leaks);
|
|
15400
15410
|
|
|
15401
15411
|
if (leaks.length) {
|
|
15402
|
-
var msg = `global leak(s) detected: ${leaks.map(e => `'${e}'`).join(
|
|
15412
|
+
var msg = `global leak(s) detected: ${leaks.map((e) => `'${e}'`).join(", ")}`;
|
|
15403
15413
|
this.fail(test, new Error(msg));
|
|
15404
15414
|
}
|
|
15405
15415
|
};
|
|
@@ -15435,13 +15445,13 @@
|
|
|
15435
15445
|
throw err;
|
|
15436
15446
|
}
|
|
15437
15447
|
throw createFatalError(
|
|
15438
|
-
|
|
15439
|
-
err
|
|
15448
|
+
"Test failed after root suite execution completed!",
|
|
15449
|
+
err,
|
|
15440
15450
|
);
|
|
15441
15451
|
}
|
|
15442
15452
|
|
|
15443
15453
|
++this.failures;
|
|
15444
|
-
debug(
|
|
15454
|
+
debug("total number of failures: %d", this.failures);
|
|
15445
15455
|
test.state = STATE_FAILED;
|
|
15446
15456
|
|
|
15447
15457
|
if (!isError(err)) {
|
|
@@ -15505,8 +15515,8 @@
|
|
|
15505
15515
|
|
|
15506
15516
|
self.emit(constants$1.EVENT_HOOK_BEGIN, hook);
|
|
15507
15517
|
|
|
15508
|
-
if (!hook.listeners(
|
|
15509
|
-
self._addEventListener(hook,
|
|
15518
|
+
if (!hook.listeners("error").length) {
|
|
15519
|
+
self._addEventListener(hook, "error", function (err) {
|
|
15510
15520
|
self.fail(hook, err);
|
|
15511
15521
|
});
|
|
15512
15522
|
}
|
|
@@ -15529,7 +15539,7 @@
|
|
|
15529
15539
|
}
|
|
15530
15540
|
self.emit(constants$1.EVENT_HOOK_END, hook);
|
|
15531
15541
|
hook.pending = false; // activates hook for next test
|
|
15532
|
-
return fn(new Error(
|
|
15542
|
+
return fn(new Error("abort hookDown"));
|
|
15533
15543
|
} else if (name === HOOK_TYPE_BEFORE_ALL) {
|
|
15534
15544
|
suite.tests.forEach(function (test) {
|
|
15535
15545
|
test.pending = true;
|
|
@@ -15540,7 +15550,7 @@
|
|
|
15540
15550
|
hooks = [];
|
|
15541
15551
|
} else {
|
|
15542
15552
|
hook.pending = false;
|
|
15543
|
-
var errForbid = createUnsupportedError$1(
|
|
15553
|
+
var errForbid = createUnsupportedError$1("`this.skip` forbidden");
|
|
15544
15554
|
self.fail(hook, errForbid);
|
|
15545
15555
|
return fn(errForbid);
|
|
15546
15556
|
}
|
|
@@ -15564,7 +15574,7 @@
|
|
|
15564
15574
|
if (hook.parent.title) {
|
|
15565
15575
|
parentTitle = hook.parent.title;
|
|
15566
15576
|
} else {
|
|
15567
|
-
parentTitle = hook.parent.root ?
|
|
15577
|
+
parentTitle = hook.parent.root ? "{root}" : "";
|
|
15568
15578
|
}
|
|
15569
15579
|
hook.title = `${hook.originalTitle} in "${parentTitle}"`;
|
|
15570
15580
|
}
|
|
@@ -15671,7 +15681,7 @@
|
|
|
15671
15681
|
if (this.asyncOnly) {
|
|
15672
15682
|
test.asyncOnly = true;
|
|
15673
15683
|
}
|
|
15674
|
-
this._addEventListener(test,
|
|
15684
|
+
this._addEventListener(test, "error", function (err) {
|
|
15675
15685
|
self.fail(test, err);
|
|
15676
15686
|
});
|
|
15677
15687
|
if (this.allowUncaught) {
|
|
@@ -15769,7 +15779,7 @@
|
|
|
15769
15779
|
// static skip, no hooks are executed
|
|
15770
15780
|
if (test.isPending()) {
|
|
15771
15781
|
if (self.forbidPending) {
|
|
15772
|
-
self.fail(test, new Error(
|
|
15782
|
+
self.fail(test, new Error("Pending test forbidden"), true);
|
|
15773
15783
|
} else {
|
|
15774
15784
|
test.state = STATE_PENDING;
|
|
15775
15785
|
self.emit(constants$1.EVENT_TEST_PENDING, test);
|
|
@@ -15784,7 +15794,7 @@
|
|
|
15784
15794
|
// conditional skip within beforeEach
|
|
15785
15795
|
if (test.isPending()) {
|
|
15786
15796
|
if (self.forbidPending) {
|
|
15787
|
-
self.fail(test, new Error(
|
|
15797
|
+
self.fail(test, new Error("Pending test forbidden"), true);
|
|
15788
15798
|
} else {
|
|
15789
15799
|
test.state = STATE_PENDING;
|
|
15790
15800
|
self.emit(constants$1.EVENT_TEST_PENDING, test);
|
|
@@ -15807,7 +15817,7 @@
|
|
|
15807
15817
|
// conditional skip within it
|
|
15808
15818
|
if (test.pending) {
|
|
15809
15819
|
if (self.forbidPending) {
|
|
15810
|
-
self.fail(test, new Error(
|
|
15820
|
+
self.fail(test, new Error("Pending test forbidden"), true);
|
|
15811
15821
|
} else {
|
|
15812
15822
|
test.state = STATE_PENDING;
|
|
15813
15823
|
self.emit(constants$1.EVENT_TEST_PENDING, test);
|
|
@@ -15858,10 +15868,10 @@
|
|
|
15858
15868
|
var self = this;
|
|
15859
15869
|
var total = this.grepTotal(suite);
|
|
15860
15870
|
|
|
15861
|
-
debug(
|
|
15871
|
+
debug("runSuite(): running %s", suite.fullTitle());
|
|
15862
15872
|
|
|
15863
15873
|
if (!total || (self.failures && suite._bail)) {
|
|
15864
|
-
debug(
|
|
15874
|
+
debug("runSuite(): bailing");
|
|
15865
15875
|
return fn();
|
|
15866
15876
|
}
|
|
15867
15877
|
|
|
@@ -15947,32 +15957,32 @@
|
|
|
15947
15957
|
// of `Runner`.
|
|
15948
15958
|
if (!(this instanceof Runner)) {
|
|
15949
15959
|
throw createFatalError(
|
|
15950
|
-
|
|
15951
|
-
this
|
|
15960
|
+
"Runner#uncaught() called with invalid context",
|
|
15961
|
+
this,
|
|
15952
15962
|
);
|
|
15953
15963
|
}
|
|
15954
15964
|
if (err instanceof Pending) {
|
|
15955
|
-
debug(
|
|
15965
|
+
debug("uncaught(): caught a Pending");
|
|
15956
15966
|
return;
|
|
15957
15967
|
}
|
|
15958
15968
|
// browser does not exit script when throwing in global.onerror()
|
|
15959
15969
|
if (this.allowUncaught && !utils$1.isBrowser()) {
|
|
15960
|
-
debug(
|
|
15970
|
+
debug("uncaught(): bubbling exception due to --allow-uncaught");
|
|
15961
15971
|
throw err;
|
|
15962
15972
|
}
|
|
15963
15973
|
|
|
15964
15974
|
if (this.state === constants$1.STATE_STOPPED) {
|
|
15965
|
-
debug(
|
|
15975
|
+
debug("uncaught(): throwing after run has completed!");
|
|
15966
15976
|
throw err;
|
|
15967
15977
|
}
|
|
15968
15978
|
|
|
15969
15979
|
if (err) {
|
|
15970
|
-
debug(
|
|
15980
|
+
debug("uncaught(): got truthy exception %O", err);
|
|
15971
15981
|
} else {
|
|
15972
|
-
debug(
|
|
15982
|
+
debug("uncaught(): undefined/falsy exception");
|
|
15973
15983
|
err = createInvalidExceptionError(
|
|
15974
|
-
|
|
15975
|
-
err
|
|
15984
|
+
"Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger",
|
|
15985
|
+
err,
|
|
15976
15986
|
);
|
|
15977
15987
|
}
|
|
15978
15988
|
|
|
@@ -15985,16 +15995,16 @@
|
|
|
15985
15995
|
var runnable = this.currentRunnable;
|
|
15986
15996
|
|
|
15987
15997
|
if (!runnable) {
|
|
15988
|
-
runnable = new Runnable$1(
|
|
15989
|
-
debug(
|
|
15998
|
+
runnable = new Runnable$1("Uncaught error outside test suite");
|
|
15999
|
+
debug("uncaught(): no current Runnable; created a phony one");
|
|
15990
16000
|
runnable.parent = this.suite;
|
|
15991
16001
|
|
|
15992
16002
|
if (this.state === constants$1.STATE_RUNNING) {
|
|
15993
|
-
debug(
|
|
16003
|
+
debug("uncaught(): failing gracefully");
|
|
15994
16004
|
this.fail(runnable, err);
|
|
15995
16005
|
} else {
|
|
15996
16006
|
// Can't recover from this failure
|
|
15997
|
-
debug(
|
|
16007
|
+
debug("uncaught(): test run has not yet started; unrecoverable");
|
|
15998
16008
|
this.emit(constants$1.EVENT_RUN_BEGIN);
|
|
15999
16009
|
this.fail(runnable, err);
|
|
16000
16010
|
this.emit(constants$1.EVENT_RUN_END);
|
|
@@ -16006,11 +16016,11 @@
|
|
|
16006
16016
|
runnable.clearTimeout();
|
|
16007
16017
|
|
|
16008
16018
|
if (runnable.isFailed()) {
|
|
16009
|
-
debug(
|
|
16019
|
+
debug("uncaught(): Runnable has already failed");
|
|
16010
16020
|
// Ignore error if already failed
|
|
16011
16021
|
return;
|
|
16012
16022
|
} else if (runnable.isPending()) {
|
|
16013
|
-
debug(
|
|
16023
|
+
debug("uncaught(): pending Runnable wound up failing!");
|
|
16014
16024
|
// report 'pending test' retrospectively as failed
|
|
16015
16025
|
this.fail(runnable, err, true);
|
|
16016
16026
|
return;
|
|
@@ -16019,11 +16029,11 @@
|
|
|
16019
16029
|
// we cannot recover gracefully if a Runnable has already passed
|
|
16020
16030
|
// then fails asynchronously
|
|
16021
16031
|
if (runnable.isPassed()) {
|
|
16022
|
-
debug(
|
|
16032
|
+
debug("uncaught(): Runnable has already passed; bailing gracefully");
|
|
16023
16033
|
this.fail(runnable, err);
|
|
16024
16034
|
this.abort();
|
|
16025
16035
|
} else {
|
|
16026
|
-
debug(
|
|
16036
|
+
debug("uncaught(): forcing Runnable to complete with Error");
|
|
16027
16037
|
return runnable.callback(err);
|
|
16028
16038
|
}
|
|
16029
16039
|
};
|
|
@@ -16042,30 +16052,30 @@
|
|
|
16042
16052
|
var rootSuite = this.suite;
|
|
16043
16053
|
var options = opts.options || {};
|
|
16044
16054
|
|
|
16045
|
-
debug(
|
|
16055
|
+
debug("run(): got options: %O", options);
|
|
16046
16056
|
fn = fn || function () {};
|
|
16047
16057
|
|
|
16048
16058
|
const end = () => {
|
|
16049
16059
|
if (!this.total && this._opts.failZero) this.failures = 1;
|
|
16050
16060
|
|
|
16051
|
-
debug(
|
|
16061
|
+
debug("run(): root suite completed; emitting %s", constants$1.EVENT_RUN_END);
|
|
16052
16062
|
this.emit(constants$1.EVENT_RUN_END);
|
|
16053
16063
|
};
|
|
16054
16064
|
|
|
16055
16065
|
const begin = () => {
|
|
16056
|
-
debug(
|
|
16066
|
+
debug("run(): emitting %s", constants$1.EVENT_RUN_BEGIN);
|
|
16057
16067
|
this.emit(constants$1.EVENT_RUN_BEGIN);
|
|
16058
|
-
debug(
|
|
16068
|
+
debug("run(): emitted %s", constants$1.EVENT_RUN_BEGIN);
|
|
16059
16069
|
|
|
16060
16070
|
this.runSuite(rootSuite, end);
|
|
16061
16071
|
};
|
|
16062
16072
|
|
|
16063
16073
|
const prepare = () => {
|
|
16064
|
-
debug(
|
|
16074
|
+
debug("run(): starting");
|
|
16065
16075
|
// If there is an `only` filter
|
|
16066
16076
|
if (rootSuite.hasOnly()) {
|
|
16067
16077
|
rootSuite.filterOnly();
|
|
16068
|
-
debug(
|
|
16078
|
+
debug("run(): filtered exclusive Runnables");
|
|
16069
16079
|
}
|
|
16070
16080
|
this.state = constants$1.STATE_RUNNING;
|
|
16071
16081
|
if (this._opts.delay) {
|
|
@@ -16078,7 +16088,7 @@
|
|
|
16078
16088
|
|
|
16079
16089
|
// references cleanup to avoid memory leaks
|
|
16080
16090
|
if (this._opts.cleanReferencesAfterRun) {
|
|
16081
|
-
this.on(constants$1.EVENT_SUITE_END, suite => {
|
|
16091
|
+
this.on(constants$1.EVENT_SUITE_END, (suite) => {
|
|
16082
16092
|
suite.cleanReferences();
|
|
16083
16093
|
});
|
|
16084
16094
|
}
|
|
@@ -16086,21 +16096,21 @@
|
|
|
16086
16096
|
// callback
|
|
16087
16097
|
this.on(constants$1.EVENT_RUN_END, function () {
|
|
16088
16098
|
this.state = constants$1.STATE_STOPPED;
|
|
16089
|
-
debug(
|
|
16099
|
+
debug("run(): emitted %s", constants$1.EVENT_RUN_END);
|
|
16090
16100
|
fn(this.failures);
|
|
16091
16101
|
});
|
|
16092
16102
|
|
|
16093
|
-
this._removeEventListener(process,
|
|
16094
|
-
this._removeEventListener(process,
|
|
16095
|
-
this._addEventListener(process,
|
|
16096
|
-
this._addEventListener(process,
|
|
16103
|
+
this._removeEventListener(process, "uncaughtException", this.uncaught);
|
|
16104
|
+
this._removeEventListener(process, "unhandledRejection", this.unhandled);
|
|
16105
|
+
this._addEventListener(process, "uncaughtException", this.uncaught);
|
|
16106
|
+
this._addEventListener(process, "unhandledRejection", this.unhandled);
|
|
16097
16107
|
|
|
16098
16108
|
if (this._opts.delay) {
|
|
16099
16109
|
// for reporters, I guess.
|
|
16100
16110
|
// might be nice to debounce some dots while we wait.
|
|
16101
16111
|
this.emit(constants$1.EVENT_DELAY_BEGIN, rootSuite);
|
|
16102
16112
|
rootSuite.once(EVENT_ROOT_SUITE_RUN, prepare);
|
|
16103
|
-
debug(
|
|
16113
|
+
debug("run(): waiting for green light due to --delay");
|
|
16104
16114
|
} else {
|
|
16105
16115
|
Runner.immediately(prepare);
|
|
16106
16116
|
}
|
|
@@ -16144,7 +16154,7 @@
|
|
|
16144
16154
|
* @returns {Promise<number>} Failure count
|
|
16145
16155
|
*/
|
|
16146
16156
|
Runner.prototype.runAsync = async function runAsync(opts = {}) {
|
|
16147
|
-
return new Promise(resolve => {
|
|
16157
|
+
return new Promise((resolve) => {
|
|
16148
16158
|
this.run(resolve, opts);
|
|
16149
16159
|
});
|
|
16150
16160
|
};
|
|
@@ -16157,7 +16167,7 @@
|
|
|
16157
16167
|
* @return {Runner} Runner instance.
|
|
16158
16168
|
*/
|
|
16159
16169
|
Runner.prototype.abort = function () {
|
|
16160
|
-
debug(
|
|
16170
|
+
debug("abort(): aborting");
|
|
16161
16171
|
this._abort = true;
|
|
16162
16172
|
|
|
16163
16173
|
return this;
|
|
@@ -16185,7 +16195,7 @@
|
|
|
16185
16195
|
* @abstract
|
|
16186
16196
|
*/
|
|
16187
16197
|
Runner.prototype.workerReporter = function () {
|
|
16188
|
-
throw createUnsupportedError$1(
|
|
16198
|
+
throw createUnsupportedError$1("workerReporter() not supported in serial mode");
|
|
16189
16199
|
};
|
|
16190
16200
|
|
|
16191
16201
|
/**
|
|
@@ -16222,12 +16232,12 @@
|
|
|
16222
16232
|
}
|
|
16223
16233
|
|
|
16224
16234
|
var matched = ok.filter(function (ok) {
|
|
16225
|
-
if (~ok.indexOf(
|
|
16226
|
-
return key.indexOf(ok.split(
|
|
16235
|
+
if (~ok.indexOf("*")) {
|
|
16236
|
+
return key.indexOf(ok.split("*")[0]) === 0;
|
|
16227
16237
|
}
|
|
16228
16238
|
return key === ok;
|
|
16229
16239
|
});
|
|
16230
|
-
return !matched.length && (!commonjsGlobal.navigator || key !==
|
|
16240
|
+
return !matched.length && (!commonjsGlobal.navigator || key !== "onerror");
|
|
16231
16241
|
});
|
|
16232
16242
|
}
|
|
16233
16243
|
|
|
@@ -16240,7 +16250,7 @@
|
|
|
16240
16250
|
* @returns {boolean}
|
|
16241
16251
|
*/
|
|
16242
16252
|
function isError(err) {
|
|
16243
|
-
return err instanceof Error || (err && typeof err.message ===
|
|
16253
|
+
return err instanceof Error || (err && typeof err.message === "string");
|
|
16244
16254
|
}
|
|
16245
16255
|
|
|
16246
16256
|
/**
|
|
@@ -16254,8 +16264,8 @@
|
|
|
16254
16264
|
function thrown2Error(err) {
|
|
16255
16265
|
return new Error(
|
|
16256
16266
|
`the ${utils$1.canonicalType(err)} ${stringify(
|
|
16257
|
-
err
|
|
16258
|
-
)} was thrown, throw an Error :)
|
|
16267
|
+
err,
|
|
16268
|
+
)} was thrown, throw an Error :)`,
|
|
16259
16269
|
);
|
|
16260
16270
|
}
|
|
16261
16271
|
|
|
@@ -16296,7 +16306,7 @@
|
|
|
16296
16306
|
const isBrowser = utils.isBrowser();
|
|
16297
16307
|
|
|
16298
16308
|
function getBrowserWindowSize() {
|
|
16299
|
-
if (
|
|
16309
|
+
if ("innerHeight" in commonjsGlobal) {
|
|
16300
16310
|
return [commonjsGlobal.innerHeight, commonjsGlobal.innerWidth];
|
|
16301
16311
|
}
|
|
16302
16312
|
// In a Web Worker, the DOM Window is not available.
|
|
@@ -16346,25 +16356,25 @@
|
|
|
16346
16356
|
exports.colors = {
|
|
16347
16357
|
pass: 90,
|
|
16348
16358
|
fail: 31,
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16359
|
+
"bright pass": 92,
|
|
16360
|
+
"bright fail": 91,
|
|
16361
|
+
"bright yellow": 93,
|
|
16352
16362
|
pending: 36,
|
|
16353
16363
|
suite: 0,
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16364
|
+
"error title": 0,
|
|
16365
|
+
"error message": 31,
|
|
16366
|
+
"error stack": 90,
|
|
16357
16367
|
checkmark: 32,
|
|
16358
16368
|
fast: 90,
|
|
16359
16369
|
medium: 33,
|
|
16360
16370
|
slow: 31,
|
|
16361
16371
|
green: 32,
|
|
16362
16372
|
light: 90,
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16373
|
+
"diff gutter": 90,
|
|
16374
|
+
"diff added": 32,
|
|
16375
|
+
"diff removed": 31,
|
|
16376
|
+
"diff added inline": "30;42",
|
|
16377
|
+
"diff removed inline": "30;41",
|
|
16368
16378
|
};
|
|
16369
16379
|
|
|
16370
16380
|
/**
|
|
@@ -16374,9 +16384,9 @@
|
|
|
16374
16384
|
exports.symbols = {
|
|
16375
16385
|
ok: symbols.success,
|
|
16376
16386
|
err: symbols.error,
|
|
16377
|
-
dot:
|
|
16378
|
-
comma:
|
|
16379
|
-
bang:
|
|
16387
|
+
dot: ".",
|
|
16388
|
+
comma: ",",
|
|
16389
|
+
bang: "!",
|
|
16380
16390
|
};
|
|
16381
16391
|
|
|
16382
16392
|
/**
|
|
@@ -16394,7 +16404,7 @@
|
|
|
16394
16404
|
if (!exports.useColors) {
|
|
16395
16405
|
return String(str);
|
|
16396
16406
|
}
|
|
16397
|
-
return
|
|
16407
|
+
return "\u001b[" + exports.colors[type] + "m" + str + "\u001b[0m";
|
|
16398
16408
|
});
|
|
16399
16409
|
|
|
16400
16410
|
/**
|
|
@@ -16402,7 +16412,7 @@
|
|
|
16402
16412
|
*/
|
|
16403
16413
|
|
|
16404
16414
|
exports.window = {
|
|
16405
|
-
width: 75
|
|
16415
|
+
width: 75,
|
|
16406
16416
|
};
|
|
16407
16417
|
|
|
16408
16418
|
if (isatty) {
|
|
@@ -16419,19 +16429,19 @@
|
|
|
16419
16429
|
|
|
16420
16430
|
exports.cursor = {
|
|
16421
16431
|
hide: function () {
|
|
16422
|
-
isatty && process.stdout.write(
|
|
16432
|
+
isatty && process.stdout.write("\u001b[?25l");
|
|
16423
16433
|
},
|
|
16424
16434
|
|
|
16425
16435
|
show: function () {
|
|
16426
|
-
isatty && process.stdout.write(
|
|
16436
|
+
isatty && process.stdout.write("\u001b[?25h");
|
|
16427
16437
|
},
|
|
16428
16438
|
|
|
16429
16439
|
deleteLine: function () {
|
|
16430
|
-
isatty && process.stdout.write(
|
|
16440
|
+
isatty && process.stdout.write("\u001b[2K");
|
|
16431
16441
|
},
|
|
16432
16442
|
|
|
16433
16443
|
beginningOfLine: function () {
|
|
16434
|
-
isatty && process.stdout.write(
|
|
16444
|
+
isatty && process.stdout.write("\u001b[0G");
|
|
16435
16445
|
},
|
|
16436
16446
|
|
|
16437
16447
|
CR: function () {
|
|
@@ -16439,9 +16449,9 @@
|
|
|
16439
16449
|
exports.cursor.deleteLine();
|
|
16440
16450
|
exports.cursor.beginningOfLine();
|
|
16441
16451
|
} else {
|
|
16442
|
-
process.stdout.write(
|
|
16452
|
+
process.stdout.write("\r");
|
|
16443
16453
|
}
|
|
16444
|
-
}
|
|
16454
|
+
},
|
|
16445
16455
|
};
|
|
16446
16456
|
|
|
16447
16457
|
var showDiff = (exports.showDiff = function (err) {
|
|
@@ -16490,11 +16500,11 @@
|
|
|
16490
16500
|
return result;
|
|
16491
16501
|
} catch (err) {
|
|
16492
16502
|
var msg =
|
|
16493
|
-
|
|
16494
|
-
color(
|
|
16495
|
-
|
|
16496
|
-
color(
|
|
16497
|
-
|
|
16503
|
+
"\n " +
|
|
16504
|
+
color("diff added", "+ expected") +
|
|
16505
|
+
" " +
|
|
16506
|
+
color("diff removed", "- actual: failed to generate Mocha diff") +
|
|
16507
|
+
"\n";
|
|
16498
16508
|
return msg;
|
|
16499
16509
|
}
|
|
16500
16510
|
});
|
|
@@ -16509,17 +16519,17 @@
|
|
|
16509
16519
|
*/
|
|
16510
16520
|
var getFullErrorStack = function (err, seen) {
|
|
16511
16521
|
if (seen && seen.has(err)) {
|
|
16512
|
-
return { message:
|
|
16522
|
+
return { message: "", msg: "<circular>", stack: "" };
|
|
16513
16523
|
}
|
|
16514
16524
|
|
|
16515
16525
|
var message;
|
|
16516
16526
|
|
|
16517
|
-
if (typeof err.inspect ===
|
|
16518
|
-
message = err.inspect() +
|
|
16519
|
-
} else if (err.message && typeof err.message.toString ===
|
|
16520
|
-
message = err.message +
|
|
16527
|
+
if (typeof err.inspect === "function") {
|
|
16528
|
+
message = err.inspect() + "";
|
|
16529
|
+
} else if (err.message && typeof err.message.toString === "function") {
|
|
16530
|
+
message = err.message + "";
|
|
16521
16531
|
} else {
|
|
16522
|
-
message =
|
|
16532
|
+
message = "";
|
|
16523
16533
|
}
|
|
16524
16534
|
|
|
16525
16535
|
var msg;
|
|
@@ -16538,14 +16548,17 @@
|
|
|
16538
16548
|
seen = seen || new Set();
|
|
16539
16549
|
seen.add(err);
|
|
16540
16550
|
const causeStack = getFullErrorStack(err.cause, seen);
|
|
16541
|
-
stack +=
|
|
16551
|
+
stack +=
|
|
16552
|
+
"\n Caused by: " +
|
|
16553
|
+
causeStack.msg +
|
|
16554
|
+
(causeStack.stack ? "\n" + causeStack.stack : "");
|
|
16542
16555
|
}
|
|
16543
16556
|
}
|
|
16544
16557
|
|
|
16545
16558
|
return {
|
|
16546
16559
|
message,
|
|
16547
16560
|
msg,
|
|
16548
|
-
stack
|
|
16561
|
+
stack,
|
|
16549
16562
|
};
|
|
16550
16563
|
};
|
|
16551
16564
|
|
|
@@ -16564,9 +16577,9 @@
|
|
|
16564
16577
|
failures.forEach(function (test, i) {
|
|
16565
16578
|
// format
|
|
16566
16579
|
var fmt =
|
|
16567
|
-
color(
|
|
16568
|
-
color(
|
|
16569
|
-
color(
|
|
16580
|
+
color("error title", " %s) %s:\n") +
|
|
16581
|
+
color("error message", " %s") +
|
|
16582
|
+
color("error stack", "\n%s\n");
|
|
16570
16583
|
|
|
16571
16584
|
// msg
|
|
16572
16585
|
var err;
|
|
@@ -16584,30 +16597,30 @@
|
|
|
16584
16597
|
|
|
16585
16598
|
// uncaught
|
|
16586
16599
|
if (err.uncaught) {
|
|
16587
|
-
msg =
|
|
16600
|
+
msg = "Uncaught " + msg;
|
|
16588
16601
|
}
|
|
16589
16602
|
// explicitly show diff
|
|
16590
16603
|
if (!exports.hideDiff && showDiff(err)) {
|
|
16591
16604
|
stringifyDiffObjs(err);
|
|
16592
16605
|
fmt =
|
|
16593
|
-
color(
|
|
16606
|
+
color("error title", " %s) %s:\n%s") + color("error stack", "\n%s\n");
|
|
16594
16607
|
var match = message.match(/^([^:]+): expected/);
|
|
16595
|
-
msg =
|
|
16608
|
+
msg = "\n " + color("error message", match ? match[1] : msg);
|
|
16596
16609
|
|
|
16597
16610
|
msg += generateDiff(err.actual, err.expected);
|
|
16598
16611
|
}
|
|
16599
16612
|
|
|
16600
16613
|
// indent stack trace
|
|
16601
|
-
stack = stack.replace(/^/gm,
|
|
16614
|
+
stack = stack.replace(/^/gm, " ");
|
|
16602
16615
|
|
|
16603
16616
|
// indented test title
|
|
16604
|
-
var testTitle =
|
|
16617
|
+
var testTitle = "";
|
|
16605
16618
|
test.titlePath().forEach(function (str, index) {
|
|
16606
16619
|
if (index !== 0) {
|
|
16607
|
-
testTitle +=
|
|
16620
|
+
testTitle += "\n ";
|
|
16608
16621
|
}
|
|
16609
16622
|
for (var i = 0; i < index; i++) {
|
|
16610
|
-
testTitle +=
|
|
16623
|
+
testTitle += " ";
|
|
16611
16624
|
}
|
|
16612
16625
|
testTitle += str;
|
|
16613
16626
|
});
|
|
@@ -16632,7 +16645,7 @@
|
|
|
16632
16645
|
var failures = (this.failures = []);
|
|
16633
16646
|
|
|
16634
16647
|
if (!runner) {
|
|
16635
|
-
throw new TypeError(
|
|
16648
|
+
throw new TypeError("Missing runner argument");
|
|
16636
16649
|
}
|
|
16637
16650
|
this.options = options || {};
|
|
16638
16651
|
this.runner = runner;
|
|
@@ -16646,11 +16659,11 @@
|
|
|
16646
16659
|
|
|
16647
16660
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16648
16661
|
if (test.duration > test.slow()) {
|
|
16649
|
-
test.speed =
|
|
16662
|
+
test.speed = "slow";
|
|
16650
16663
|
} else if (test.duration > test.slow() / 2) {
|
|
16651
|
-
test.speed =
|
|
16664
|
+
test.speed = "medium";
|
|
16652
16665
|
} else {
|
|
16653
|
-
test.speed =
|
|
16666
|
+
test.speed = "fast";
|
|
16654
16667
|
}
|
|
16655
16668
|
});
|
|
16656
16669
|
|
|
@@ -16682,22 +16695,22 @@
|
|
|
16682
16695
|
|
|
16683
16696
|
// passes
|
|
16684
16697
|
fmt =
|
|
16685
|
-
color(
|
|
16686
|
-
color(
|
|
16687
|
-
color(
|
|
16698
|
+
color("bright pass", " ") +
|
|
16699
|
+
color("green", " %d passing") +
|
|
16700
|
+
color("light", " (%s)");
|
|
16688
16701
|
|
|
16689
16702
|
Base.consoleLog(fmt, stats.passes || 0, milliseconds(stats.duration));
|
|
16690
16703
|
|
|
16691
16704
|
// pending
|
|
16692
16705
|
if (stats.pending) {
|
|
16693
|
-
fmt = color(
|
|
16706
|
+
fmt = color("pending", " ") + color("pending", " %d pending");
|
|
16694
16707
|
|
|
16695
16708
|
Base.consoleLog(fmt, stats.pending);
|
|
16696
16709
|
}
|
|
16697
16710
|
|
|
16698
16711
|
// failures
|
|
16699
16712
|
if (stats.failures) {
|
|
16700
|
-
fmt = color(
|
|
16713
|
+
fmt = color("fail", " %d failing");
|
|
16701
16714
|
|
|
16702
16715
|
Base.consoleLog(fmt, stats.failures);
|
|
16703
16716
|
|
|
@@ -16718,7 +16731,7 @@
|
|
|
16718
16731
|
*/
|
|
16719
16732
|
function pad(str, len) {
|
|
16720
16733
|
str = String(str);
|
|
16721
|
-
return Array(len - str.length + 1).join(
|
|
16734
|
+
return Array(len - str.length + 1).join(" ") + str;
|
|
16722
16735
|
}
|
|
16723
16736
|
|
|
16724
16737
|
/**
|
|
@@ -16733,28 +16746,28 @@
|
|
|
16733
16746
|
var msg = errorDiff(actual, expected);
|
|
16734
16747
|
|
|
16735
16748
|
// linenos
|
|
16736
|
-
var lines = msg.split(
|
|
16749
|
+
var lines = msg.split("\n");
|
|
16737
16750
|
if (lines.length > 4) {
|
|
16738
16751
|
var width = String(lines.length).length;
|
|
16739
16752
|
msg = lines
|
|
16740
16753
|
.map(function (str, i) {
|
|
16741
|
-
return pad(++i, width) +
|
|
16754
|
+
return pad(++i, width) + " |" + " " + str;
|
|
16742
16755
|
})
|
|
16743
|
-
.join(
|
|
16756
|
+
.join("\n");
|
|
16744
16757
|
}
|
|
16745
16758
|
|
|
16746
16759
|
// legend
|
|
16747
16760
|
msg =
|
|
16748
|
-
|
|
16749
|
-
color(
|
|
16750
|
-
|
|
16751
|
-
color(
|
|
16752
|
-
|
|
16761
|
+
"\n" +
|
|
16762
|
+
color("diff removed inline", "actual") +
|
|
16763
|
+
" " +
|
|
16764
|
+
color("diff added inline", "expected") +
|
|
16765
|
+
"\n\n" +
|
|
16753
16766
|
msg +
|
|
16754
|
-
|
|
16767
|
+
"\n";
|
|
16755
16768
|
|
|
16756
16769
|
// indent
|
|
16757
|
-
msg = msg.replace(/^/gm,
|
|
16770
|
+
msg = msg.replace(/^/gm, " ");
|
|
16758
16771
|
return msg;
|
|
16759
16772
|
}
|
|
16760
16773
|
|
|
@@ -16767,16 +16780,16 @@
|
|
|
16767
16780
|
* @return {string} The diff.
|
|
16768
16781
|
*/
|
|
16769
16782
|
function unifiedDiff(actual, expected) {
|
|
16770
|
-
var indent =
|
|
16783
|
+
var indent = " ";
|
|
16771
16784
|
function cleanUp(line) {
|
|
16772
|
-
if (line[0] ===
|
|
16773
|
-
return indent + colorLines(
|
|
16785
|
+
if (line[0] === "+") {
|
|
16786
|
+
return indent + colorLines("diff added", line);
|
|
16774
16787
|
}
|
|
16775
|
-
if (line[0] ===
|
|
16776
|
-
return indent + colorLines(
|
|
16788
|
+
if (line[0] === "-") {
|
|
16789
|
+
return indent + colorLines("diff removed", line);
|
|
16777
16790
|
}
|
|
16778
16791
|
if (line.match(/@@/)) {
|
|
16779
|
-
return
|
|
16792
|
+
return "--";
|
|
16780
16793
|
}
|
|
16781
16794
|
if (line.match(/\\ No newline/)) {
|
|
16782
16795
|
return null;
|
|
@@ -16784,17 +16797,17 @@
|
|
|
16784
16797
|
return indent + line;
|
|
16785
16798
|
}
|
|
16786
16799
|
function notBlank(line) {
|
|
16787
|
-
return typeof line !==
|
|
16800
|
+
return typeof line !== "undefined" && line !== null;
|
|
16788
16801
|
}
|
|
16789
|
-
var msg = diff.createPatch(
|
|
16790
|
-
var lines = msg.split(
|
|
16802
|
+
var msg = diff.createPatch("string", actual, expected);
|
|
16803
|
+
var lines = msg.split("\n").splice(5);
|
|
16791
16804
|
return (
|
|
16792
|
-
|
|
16793
|
-
colorLines(
|
|
16794
|
-
|
|
16795
|
-
colorLines(
|
|
16796
|
-
|
|
16797
|
-
lines.map(cleanUp).filter(notBlank).join(
|
|
16805
|
+
"\n " +
|
|
16806
|
+
colorLines("diff added", "+ expected") +
|
|
16807
|
+
" " +
|
|
16808
|
+
colorLines("diff removed", "- actual") +
|
|
16809
|
+
"\n\n" +
|
|
16810
|
+
lines.map(cleanUp).filter(notBlank).join("\n")
|
|
16798
16811
|
);
|
|
16799
16812
|
}
|
|
16800
16813
|
|
|
@@ -16811,14 +16824,14 @@
|
|
|
16811
16824
|
.diffWordsWithSpace(actual, expected)
|
|
16812
16825
|
.map(function (str) {
|
|
16813
16826
|
if (str.added) {
|
|
16814
|
-
return colorLines(
|
|
16827
|
+
return colorLines("diff added inline", str.value);
|
|
16815
16828
|
}
|
|
16816
16829
|
if (str.removed) {
|
|
16817
|
-
return colorLines(
|
|
16830
|
+
return colorLines("diff removed inline", str.value);
|
|
16818
16831
|
}
|
|
16819
16832
|
return str.value;
|
|
16820
16833
|
})
|
|
16821
|
-
.join(
|
|
16834
|
+
.join("");
|
|
16822
16835
|
}
|
|
16823
16836
|
|
|
16824
16837
|
/**
|
|
@@ -16831,11 +16844,11 @@
|
|
|
16831
16844
|
*/
|
|
16832
16845
|
function colorLines(name, str) {
|
|
16833
16846
|
return str
|
|
16834
|
-
.split(
|
|
16847
|
+
.split("\n")
|
|
16835
16848
|
.map(function (str) {
|
|
16836
16849
|
return color(name, str);
|
|
16837
16850
|
})
|
|
16838
|
-
.join(
|
|
16851
|
+
.join("\n");
|
|
16839
16852
|
}
|
|
16840
16853
|
|
|
16841
16854
|
/**
|
|
@@ -16908,22 +16921,22 @@
|
|
|
16908
16921
|
var n = -1;
|
|
16909
16922
|
|
|
16910
16923
|
runner.on(EVENT_RUN_BEGIN, function () {
|
|
16911
|
-
process.stdout.write(
|
|
16924
|
+
process.stdout.write("\n");
|
|
16912
16925
|
});
|
|
16913
16926
|
|
|
16914
16927
|
runner.on(EVENT_TEST_PENDING, function () {
|
|
16915
16928
|
if (++n % width === 0) {
|
|
16916
|
-
process.stdout.write(
|
|
16929
|
+
process.stdout.write("\n ");
|
|
16917
16930
|
}
|
|
16918
|
-
process.stdout.write(Base.color(
|
|
16931
|
+
process.stdout.write(Base.color("pending", Base.symbols.comma));
|
|
16919
16932
|
});
|
|
16920
16933
|
|
|
16921
16934
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
16922
16935
|
if (++n % width === 0) {
|
|
16923
|
-
process.stdout.write(
|
|
16936
|
+
process.stdout.write("\n ");
|
|
16924
16937
|
}
|
|
16925
|
-
if (test.speed ===
|
|
16926
|
-
process.stdout.write(Base.color(
|
|
16938
|
+
if (test.speed === "slow") {
|
|
16939
|
+
process.stdout.write(Base.color("bright yellow", Base.symbols.dot));
|
|
16927
16940
|
} else {
|
|
16928
16941
|
process.stdout.write(Base.color(test.speed, Base.symbols.dot));
|
|
16929
16942
|
}
|
|
@@ -16931,13 +16944,13 @@
|
|
|
16931
16944
|
|
|
16932
16945
|
runner.on(EVENT_TEST_FAIL, function () {
|
|
16933
16946
|
if (++n % width === 0) {
|
|
16934
|
-
process.stdout.write(
|
|
16947
|
+
process.stdout.write("\n ");
|
|
16935
16948
|
}
|
|
16936
|
-
process.stdout.write(Base.color(
|
|
16949
|
+
process.stdout.write(Base.color("fail", Base.symbols.bang));
|
|
16937
16950
|
});
|
|
16938
16951
|
|
|
16939
16952
|
runner.once(EVENT_RUN_END, function () {
|
|
16940
|
-
process.stdout.write(
|
|
16953
|
+
process.stdout.write("\n");
|
|
16941
16954
|
self.epilogue();
|
|
16942
16955
|
});
|
|
16943
16956
|
}
|
|
@@ -16947,7 +16960,7 @@
|
|
|
16947
16960
|
*/
|
|
16948
16961
|
inherits(Dot, Base);
|
|
16949
16962
|
|
|
16950
|
-
Dot.description =
|
|
16963
|
+
Dot.description = "dot matrix representation";
|
|
16951
16964
|
}(dot));
|
|
16952
16965
|
|
|
16953
16966
|
var doc = {exports: {}};
|
|
@@ -16995,7 +17008,7 @@
|
|
|
16995
17008
|
var indents = 2;
|
|
16996
17009
|
|
|
16997
17010
|
function indent() {
|
|
16998
|
-
return Array(indents).join(
|
|
17011
|
+
return Array(indents).join(" ");
|
|
16999
17012
|
}
|
|
17000
17013
|
|
|
17001
17014
|
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
@@ -17005,53 +17018,53 @@
|
|
|
17005
17018
|
++indents;
|
|
17006
17019
|
Base.consoleLog('%s<section class="suite">', indent());
|
|
17007
17020
|
++indents;
|
|
17008
|
-
Base.consoleLog(
|
|
17009
|
-
Base.consoleLog(
|
|
17021
|
+
Base.consoleLog("%s<h1>%s</h1>", indent(), utils.escape(suite.title));
|
|
17022
|
+
Base.consoleLog("%s<dl>", indent());
|
|
17010
17023
|
});
|
|
17011
17024
|
|
|
17012
17025
|
runner.on(EVENT_SUITE_END, function (suite) {
|
|
17013
17026
|
if (suite.root) {
|
|
17014
17027
|
return;
|
|
17015
17028
|
}
|
|
17016
|
-
Base.consoleLog(
|
|
17029
|
+
Base.consoleLog("%s</dl>", indent());
|
|
17017
17030
|
--indents;
|
|
17018
|
-
Base.consoleLog(
|
|
17031
|
+
Base.consoleLog("%s</section>", indent());
|
|
17019
17032
|
--indents;
|
|
17020
17033
|
});
|
|
17021
17034
|
|
|
17022
17035
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
17023
|
-
Base.consoleLog(
|
|
17024
|
-
Base.consoleLog(
|
|
17036
|
+
Base.consoleLog("%s <dt>%s</dt>", indent(), utils.escape(test.title));
|
|
17037
|
+
Base.consoleLog("%s <dt>%s</dt>", indent(), utils.escape(test.file));
|
|
17025
17038
|
var code = utils.escape(utils.clean(test.body));
|
|
17026
|
-
Base.consoleLog(
|
|
17039
|
+
Base.consoleLog("%s <dd><pre><code>%s</code></pre></dd>", indent(), code);
|
|
17027
17040
|
});
|
|
17028
17041
|
|
|
17029
17042
|
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
17030
17043
|
Base.consoleLog(
|
|
17031
17044
|
'%s <dt class="error">%s</dt>',
|
|
17032
17045
|
indent(),
|
|
17033
|
-
utils.escape(test.title)
|
|
17046
|
+
utils.escape(test.title),
|
|
17034
17047
|
);
|
|
17035
17048
|
Base.consoleLog(
|
|
17036
17049
|
'%s <dt class="error">%s</dt>',
|
|
17037
17050
|
indent(),
|
|
17038
|
-
utils.escape(test.file)
|
|
17051
|
+
utils.escape(test.file),
|
|
17039
17052
|
);
|
|
17040
17053
|
var code = utils.escape(utils.clean(test.body));
|
|
17041
17054
|
Base.consoleLog(
|
|
17042
17055
|
'%s <dd class="error"><pre><code>%s</code></pre></dd>',
|
|
17043
17056
|
indent(),
|
|
17044
|
-
code
|
|
17057
|
+
code,
|
|
17045
17058
|
);
|
|
17046
17059
|
Base.consoleLog(
|
|
17047
17060
|
'%s <dd class="error">%s</dd>',
|
|
17048
17061
|
indent(),
|
|
17049
|
-
utils.escape(err)
|
|
17062
|
+
utils.escape(err),
|
|
17050
17063
|
);
|
|
17051
17064
|
});
|
|
17052
17065
|
}
|
|
17053
17066
|
|
|
17054
|
-
Doc.description =
|
|
17067
|
+
Doc.description = "HTML documentation";
|
|
17055
17068
|
}(doc));
|
|
17056
17069
|
|
|
17057
17070
|
var tap = {exports: {}};
|
|
@@ -17104,7 +17117,7 @@
|
|
|
17104
17117
|
var self = this;
|
|
17105
17118
|
var n = 1;
|
|
17106
17119
|
|
|
17107
|
-
var tapVersion =
|
|
17120
|
+
var tapVersion = "12";
|
|
17108
17121
|
if (options && options.reporterOptions) {
|
|
17109
17122
|
if (options.reporterOptions.tapVersion) {
|
|
17110
17123
|
tapVersion = options.reporterOptions.tapVersion.toString();
|
|
@@ -17151,7 +17164,7 @@
|
|
|
17151
17164
|
* @return {String} title with any hash character removed
|
|
17152
17165
|
*/
|
|
17153
17166
|
function title(test) {
|
|
17154
|
-
return test.fullTitle().replace(/#/g,
|
|
17167
|
+
return test.fullTitle().replace(/#/g, "");
|
|
17155
17168
|
}
|
|
17156
17169
|
|
|
17157
17170
|
/**
|
|
@@ -17163,7 +17176,7 @@
|
|
|
17163
17176
|
*/
|
|
17164
17177
|
function println() {
|
|
17165
17178
|
var vargs = Array.from(arguments);
|
|
17166
|
-
vargs[0] +=
|
|
17179
|
+
vargs[0] += "\n";
|
|
17167
17180
|
process.stdout.write(sprintf.apply(null, vargs));
|
|
17168
17181
|
}
|
|
17169
17182
|
|
|
@@ -17178,13 +17191,13 @@
|
|
|
17178
17191
|
function createProducer(tapVersion) {
|
|
17179
17192
|
var producers = {
|
|
17180
17193
|
12: new TAP12Producer(),
|
|
17181
|
-
13: new TAP13Producer()
|
|
17194
|
+
13: new TAP13Producer(),
|
|
17182
17195
|
};
|
|
17183
17196
|
var producer = producers[tapVersion];
|
|
17184
17197
|
|
|
17185
17198
|
if (!producer) {
|
|
17186
17199
|
throw new Error(
|
|
17187
|
-
|
|
17200
|
+
"invalid or unsupported TAP version: " + JSON.stringify(tapVersion),
|
|
17188
17201
|
);
|
|
17189
17202
|
}
|
|
17190
17203
|
|
|
@@ -17217,7 +17230,7 @@
|
|
|
17217
17230
|
* @param {number} ntests - Number of tests that are planned to run.
|
|
17218
17231
|
*/
|
|
17219
17232
|
TAPProducer.prototype.writePlan = function (ntests) {
|
|
17220
|
-
println(
|
|
17233
|
+
println("%d..%d", 1, ntests);
|
|
17221
17234
|
};
|
|
17222
17235
|
|
|
17223
17236
|
/**
|
|
@@ -17228,7 +17241,7 @@
|
|
|
17228
17241
|
* @param {Test} test - Instance containing test information.
|
|
17229
17242
|
*/
|
|
17230
17243
|
TAPProducer.prototype.writePass = function (n, test) {
|
|
17231
|
-
println(
|
|
17244
|
+
println("ok %d %s", n, title(test));
|
|
17232
17245
|
};
|
|
17233
17246
|
|
|
17234
17247
|
/**
|
|
@@ -17239,7 +17252,7 @@
|
|
|
17239
17252
|
* @param {Test} test - Instance containing test information.
|
|
17240
17253
|
*/
|
|
17241
17254
|
TAPProducer.prototype.writePending = function (n, test) {
|
|
17242
|
-
println(
|
|
17255
|
+
println("ok %d %s # SKIP -", n, title(test));
|
|
17243
17256
|
};
|
|
17244
17257
|
|
|
17245
17258
|
/**
|
|
@@ -17250,7 +17263,7 @@
|
|
|
17250
17263
|
* @param {Test} test - Instance containing test information.
|
|
17251
17264
|
*/
|
|
17252
17265
|
TAPProducer.prototype.writeFail = function (n, test) {
|
|
17253
|
-
println(
|
|
17266
|
+
println("not ok %d %s", n, title(test));
|
|
17254
17267
|
};
|
|
17255
17268
|
|
|
17256
17269
|
/**
|
|
@@ -17261,10 +17274,10 @@
|
|
|
17261
17274
|
*/
|
|
17262
17275
|
TAPProducer.prototype.writeEpilogue = function (stats) {
|
|
17263
17276
|
// :TBD: Why is this not counting pending tests?
|
|
17264
|
-
println(
|
|
17265
|
-
println(
|
|
17277
|
+
println("# tests " + (stats.passes + stats.failures));
|
|
17278
|
+
println("# pass " + stats.passes);
|
|
17266
17279
|
// :TBD: Why are we not showing pending results?
|
|
17267
|
-
println(
|
|
17280
|
+
println("# fail " + stats.failures);
|
|
17268
17281
|
this.writePlan(stats.passes + stats.failures + stats.pending);
|
|
17269
17282
|
};
|
|
17270
17283
|
|
|
@@ -17288,10 +17301,10 @@
|
|
|
17288
17301
|
this.writeFail = function (n, test, err) {
|
|
17289
17302
|
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
17290
17303
|
if (err.message) {
|
|
17291
|
-
println(err.message.replace(/^/gm,
|
|
17304
|
+
println(err.message.replace(/^/gm, " "));
|
|
17292
17305
|
}
|
|
17293
17306
|
if (err.stack) {
|
|
17294
|
-
println(err.stack.replace(/^/gm,
|
|
17307
|
+
println(err.stack.replace(/^/gm, " "));
|
|
17295
17308
|
}
|
|
17296
17309
|
};
|
|
17297
17310
|
}
|
|
@@ -17319,7 +17332,7 @@
|
|
|
17319
17332
|
* @override
|
|
17320
17333
|
*/
|
|
17321
17334
|
this.writeVersion = function () {
|
|
17322
|
-
println(
|
|
17335
|
+
println("TAP version 13");
|
|
17323
17336
|
};
|
|
17324
17337
|
|
|
17325
17338
|
/**
|
|
@@ -17330,21 +17343,21 @@
|
|
|
17330
17343
|
TAPProducer.prototype.writeFail.call(this, n, test, err);
|
|
17331
17344
|
var emitYamlBlock = err.message != null || err.stack != null;
|
|
17332
17345
|
if (emitYamlBlock) {
|
|
17333
|
-
println(indent(1) +
|
|
17346
|
+
println(indent(1) + "---");
|
|
17334
17347
|
if (err.message) {
|
|
17335
|
-
println(indent(2) +
|
|
17348
|
+
println(indent(2) + "message: |-");
|
|
17336
17349
|
println(err.message.replace(/^/gm, indent(3)));
|
|
17337
17350
|
}
|
|
17338
17351
|
if (err.stack) {
|
|
17339
|
-
println(indent(2) +
|
|
17352
|
+
println(indent(2) + "stack: |-");
|
|
17340
17353
|
println(err.stack.replace(/^/gm, indent(3)));
|
|
17341
17354
|
}
|
|
17342
|
-
println(indent(1) +
|
|
17355
|
+
println(indent(1) + "...");
|
|
17343
17356
|
}
|
|
17344
17357
|
};
|
|
17345
17358
|
|
|
17346
17359
|
function indent(level) {
|
|
17347
|
-
return Array(level + 1).join(
|
|
17360
|
+
return Array(level + 1).join(" ");
|
|
17348
17361
|
}
|
|
17349
17362
|
}
|
|
17350
17363
|
|
|
@@ -17353,7 +17366,7 @@
|
|
|
17353
17366
|
*/
|
|
17354
17367
|
inherits(TAP13Producer, TAPProducer);
|
|
17355
17368
|
|
|
17356
|
-
TAP.description =
|
|
17369
|
+
TAP.description = "TAP-compatible output";
|
|
17357
17370
|
}(tap));
|
|
17358
17371
|
|
|
17359
17372
|
var json = {exports: {}};
|
|
@@ -17420,7 +17433,7 @@
|
|
|
17420
17433
|
|
|
17421
17434
|
if (options.reporterOption && options.reporterOption.output) {
|
|
17422
17435
|
if (utils.isBrowser()) {
|
|
17423
|
-
throw createUnsupportedError(
|
|
17436
|
+
throw createUnsupportedError("file output not supported in browser");
|
|
17424
17437
|
}
|
|
17425
17438
|
output = options.reporterOption.output;
|
|
17426
17439
|
}
|
|
@@ -17447,7 +17460,7 @@
|
|
|
17447
17460
|
tests: tests.map(clean),
|
|
17448
17461
|
pending: pending.map(clean),
|
|
17449
17462
|
failures: failures.map(clean),
|
|
17450
|
-
passes: passes.map(clean)
|
|
17463
|
+
passes: passes.map(clean),
|
|
17451
17464
|
};
|
|
17452
17465
|
|
|
17453
17466
|
runner.testResults = obj;
|
|
@@ -17455,11 +17468,11 @@
|
|
|
17455
17468
|
var json = JSON.stringify(obj, null, 2);
|
|
17456
17469
|
if (output) {
|
|
17457
17470
|
try {
|
|
17458
|
-
fs.mkdirSync(path.dirname(output), {recursive: true});
|
|
17471
|
+
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
17459
17472
|
fs.writeFileSync(output, json);
|
|
17460
17473
|
} catch (err) {
|
|
17461
17474
|
console.error(
|
|
17462
|
-
`${Base.symbols.err} [mocha] writing output to "${output}" failed: ${err.message}\n
|
|
17475
|
+
`${Base.symbols.err} [mocha] writing output to "${output}" failed: ${err.message}\n`,
|
|
17463
17476
|
);
|
|
17464
17477
|
process.stdout.write(json);
|
|
17465
17478
|
}
|
|
@@ -17490,7 +17503,7 @@
|
|
|
17490
17503
|
duration: test.duration,
|
|
17491
17504
|
currentRetry: test.currentRetry(),
|
|
17492
17505
|
speed: test.speed,
|
|
17493
|
-
err: cleanCycles(err)
|
|
17506
|
+
err: cleanCycles(err),
|
|
17494
17507
|
};
|
|
17495
17508
|
}
|
|
17496
17509
|
|
|
@@ -17505,16 +17518,16 @@
|
|
|
17505
17518
|
var cache = [];
|
|
17506
17519
|
return JSON.parse(
|
|
17507
17520
|
JSON.stringify(obj, function (key, value) {
|
|
17508
|
-
if (typeof value ===
|
|
17521
|
+
if (typeof value === "object" && value !== null) {
|
|
17509
17522
|
if (cache.indexOf(value) !== -1) {
|
|
17510
17523
|
// Instead of going in a circle, we'll print [object Object]
|
|
17511
|
-
return
|
|
17524
|
+
return "" + value;
|
|
17512
17525
|
}
|
|
17513
17526
|
cache.push(value);
|
|
17514
17527
|
}
|
|
17515
17528
|
|
|
17516
17529
|
return value;
|
|
17517
|
-
})
|
|
17530
|
+
}),
|
|
17518
17531
|
);
|
|
17519
17532
|
}
|
|
17520
17533
|
|
|
@@ -17533,7 +17546,7 @@
|
|
|
17533
17546
|
return res;
|
|
17534
17547
|
}
|
|
17535
17548
|
|
|
17536
|
-
JSONReporter.description =
|
|
17549
|
+
JSONReporter.description = "single JSON object";
|
|
17537
17550
|
}(json));
|
|
17538
17551
|
|
|
17539
17552
|
var html = {exports: {}};
|
|
@@ -17586,9 +17599,9 @@
|
|
|
17586
17599
|
'<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
|
|
17587
17600
|
'<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
|
|
17588
17601
|
'<li class="duration">duration: <em>0</em>s</li>' +
|
|
17589
|
-
|
|
17602
|
+
"</ul>";
|
|
17590
17603
|
|
|
17591
|
-
var playIcon =
|
|
17604
|
+
var playIcon = "‣";
|
|
17592
17605
|
|
|
17593
17606
|
/**
|
|
17594
17607
|
* Constructs a new `HTML` reporter instance.
|
|
@@ -17606,7 +17619,7 @@
|
|
|
17606
17619
|
var self = this;
|
|
17607
17620
|
var stats = this.stats;
|
|
17608
17621
|
var stat = fragment(statsTemplate);
|
|
17609
|
-
var items = stat.getElementsByTagName(
|
|
17622
|
+
var items = stat.getElementsByTagName("li");
|
|
17610
17623
|
const resultIndex = 0;
|
|
17611
17624
|
const progressIndex = 1;
|
|
17612
17625
|
const passesIndex = 2;
|
|
@@ -17617,50 +17630,50 @@
|
|
|
17617
17630
|
/** Passes text and count */
|
|
17618
17631
|
const passesStat = items[passesIndex];
|
|
17619
17632
|
/** Stat item containing the pass count (not the word, just the number) */
|
|
17620
|
-
const passesCount = passesStat.getElementsByTagName(
|
|
17633
|
+
const passesCount = passesStat.getElementsByTagName("em")[0];
|
|
17621
17634
|
/** Stat item linking to filter to show only passing tests */
|
|
17622
|
-
const passesLink = passesStat.getElementsByTagName(
|
|
17635
|
+
const passesLink = passesStat.getElementsByTagName("a")[0];
|
|
17623
17636
|
/** Failures text and count */
|
|
17624
17637
|
const failuresStat = items[failuresIndex];
|
|
17625
17638
|
/** Stat item containing the failure count (not the word, just the number) */
|
|
17626
|
-
const failuresCount = failuresStat.getElementsByTagName(
|
|
17639
|
+
const failuresCount = failuresStat.getElementsByTagName("em")[0];
|
|
17627
17640
|
/** Stat item linking to filter to show only failing tests */
|
|
17628
|
-
const failuresLink = failuresStat.getElementsByTagName(
|
|
17641
|
+
const failuresLink = failuresStat.getElementsByTagName("a")[0];
|
|
17629
17642
|
/** Stat item linking to the duration time (not the word or unit, just the number) */
|
|
17630
|
-
var duration = items[durationIndex].getElementsByTagName(
|
|
17643
|
+
var duration = items[durationIndex].getElementsByTagName("em")[0];
|
|
17631
17644
|
var report = fragment('<ul id="mocha-report"></ul>');
|
|
17632
17645
|
var stack = [report];
|
|
17633
|
-
var progressText = items[progressIndex].getElementsByTagName(
|
|
17634
|
-
var progressBar = items[progressIndex].getElementsByTagName(
|
|
17646
|
+
var progressText = items[progressIndex].getElementsByTagName("div")[0];
|
|
17647
|
+
var progressBar = items[progressIndex].getElementsByTagName("progress")[0];
|
|
17635
17648
|
var progressRing = [
|
|
17636
|
-
items[progressIndex].getElementsByClassName(
|
|
17637
|
-
items[progressIndex].getElementsByClassName(
|
|
17649
|
+
items[progressIndex].getElementsByClassName("ring-flatlight")[0],
|
|
17650
|
+
items[progressIndex].getElementsByClassName("ring-highlight")[0],
|
|
17638
17651
|
];
|
|
17639
|
-
var root = document.getElementById(
|
|
17652
|
+
var root = document.getElementById("mocha");
|
|
17640
17653
|
|
|
17641
17654
|
if (!root) {
|
|
17642
|
-
return error(
|
|
17655
|
+
return error("#mocha div missing, add it to your document");
|
|
17643
17656
|
}
|
|
17644
17657
|
|
|
17645
17658
|
// pass toggle
|
|
17646
|
-
on(passesLink,
|
|
17659
|
+
on(passesLink, "click", function (evt) {
|
|
17647
17660
|
evt.preventDefault();
|
|
17648
17661
|
unhide();
|
|
17649
|
-
var name = /pass/.test(report.className) ?
|
|
17650
|
-
report.className = report.className.replace(/fail|pass/g,
|
|
17662
|
+
var name = /pass/.test(report.className) ? "" : " pass";
|
|
17663
|
+
report.className = report.className.replace(/fail|pass/g, "") + name;
|
|
17651
17664
|
if (report.className.trim()) {
|
|
17652
|
-
hideSuitesWithout(
|
|
17665
|
+
hideSuitesWithout("test pass");
|
|
17653
17666
|
}
|
|
17654
17667
|
});
|
|
17655
17668
|
|
|
17656
17669
|
// failure toggle
|
|
17657
|
-
on(failuresLink,
|
|
17670
|
+
on(failuresLink, "click", function (evt) {
|
|
17658
17671
|
evt.preventDefault();
|
|
17659
17672
|
unhide();
|
|
17660
|
-
var name = /fail/.test(report.className) ?
|
|
17661
|
-
report.className = report.className.replace(/fail|pass/g,
|
|
17673
|
+
var name = /fail/.test(report.className) ? "" : " fail";
|
|
17674
|
+
report.className = report.className.replace(/fail|pass/g, "") + name;
|
|
17662
17675
|
if (report.className.trim()) {
|
|
17663
|
-
hideSuitesWithout(
|
|
17676
|
+
hideSuitesWithout("test fail");
|
|
17664
17677
|
}
|
|
17665
17678
|
});
|
|
17666
17679
|
|
|
@@ -17677,20 +17690,20 @@
|
|
|
17677
17690
|
var el = fragment(
|
|
17678
17691
|
'<li class="suite"><h1><a href="%s">%s</a></h1></li>',
|
|
17679
17692
|
url,
|
|
17680
|
-
escape(suite.title)
|
|
17693
|
+
escape(suite.title),
|
|
17681
17694
|
);
|
|
17682
17695
|
|
|
17683
17696
|
// container
|
|
17684
17697
|
stack[0].appendChild(el);
|
|
17685
|
-
stack.unshift(document.createElement(
|
|
17698
|
+
stack.unshift(document.createElement("ul"));
|
|
17686
17699
|
el.appendChild(stack[0]);
|
|
17687
17700
|
});
|
|
17688
17701
|
|
|
17689
17702
|
runner.on(EVENT_SUITE_END, function (suite) {
|
|
17690
17703
|
if (suite.root) {
|
|
17691
17704
|
if (stats.failures === 0) {
|
|
17692
|
-
text(resultIndicator,
|
|
17693
|
-
stat.className +=
|
|
17705
|
+
text(resultIndicator, "✓");
|
|
17706
|
+
stat.className += " pass";
|
|
17694
17707
|
}
|
|
17695
17708
|
updateStats();
|
|
17696
17709
|
return;
|
|
@@ -17704,7 +17717,7 @@
|
|
|
17704
17717
|
'<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
|
|
17705
17718
|
'<a href="%s" class="replay">' +
|
|
17706
17719
|
playIcon +
|
|
17707
|
-
|
|
17720
|
+
"</a></h2></li>";
|
|
17708
17721
|
var el = fragment(markup, test.speed, test.title, test.duration, url);
|
|
17709
17722
|
self.addCodeToggle(el, test.body);
|
|
17710
17723
|
appendToStack(el);
|
|
@@ -17713,22 +17726,22 @@
|
|
|
17713
17726
|
|
|
17714
17727
|
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
17715
17728
|
// Update stat items
|
|
17716
|
-
text(resultIndicator,
|
|
17717
|
-
stat.className +=
|
|
17729
|
+
text(resultIndicator, "✖");
|
|
17730
|
+
stat.className += " fail";
|
|
17718
17731
|
|
|
17719
17732
|
var el = fragment(
|
|
17720
17733
|
'<li class="test fail"><h2>%e <a href="%e" class="replay">' +
|
|
17721
17734
|
playIcon +
|
|
17722
|
-
|
|
17735
|
+
"</a></h2></li>",
|
|
17723
17736
|
test.title,
|
|
17724
|
-
self.testURL(test)
|
|
17737
|
+
self.testURL(test),
|
|
17725
17738
|
);
|
|
17726
17739
|
var stackString; // Note: Includes leading newline
|
|
17727
17740
|
var message = test.err.toString();
|
|
17728
17741
|
|
|
17729
17742
|
// <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
|
|
17730
17743
|
// check for the result of the stringifying.
|
|
17731
|
-
if (message ===
|
|
17744
|
+
if (message === "[object Error]") {
|
|
17732
17745
|
message = test.err.message;
|
|
17733
17746
|
}
|
|
17734
17747
|
|
|
@@ -17738,31 +17751,31 @@
|
|
|
17738
17751
|
stackString = test.err.stack;
|
|
17739
17752
|
} else {
|
|
17740
17753
|
stackString = test.err.stack.slice(
|
|
17741
|
-
test.err.message.length + indexOfMessage
|
|
17754
|
+
test.err.message.length + indexOfMessage,
|
|
17742
17755
|
);
|
|
17743
17756
|
}
|
|
17744
17757
|
} else if (test.err.sourceURL && test.err.line !== undefined) {
|
|
17745
17758
|
// Safari doesn't give you a stack. Let's at least provide a source line.
|
|
17746
|
-
stackString =
|
|
17759
|
+
stackString = "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
|
|
17747
17760
|
}
|
|
17748
17761
|
|
|
17749
|
-
stackString = stackString ||
|
|
17762
|
+
stackString = stackString || "";
|
|
17750
17763
|
|
|
17751
17764
|
if (test.err.htmlMessage && stackString) {
|
|
17752
17765
|
el.appendChild(
|
|
17753
17766
|
fragment(
|
|
17754
17767
|
'<div class="html-error">%s\n<pre class="error">%e</pre></div>',
|
|
17755
17768
|
test.err.htmlMessage,
|
|
17756
|
-
stackString
|
|
17757
|
-
)
|
|
17769
|
+
stackString,
|
|
17770
|
+
),
|
|
17758
17771
|
);
|
|
17759
17772
|
} else if (test.err.htmlMessage) {
|
|
17760
17773
|
el.appendChild(
|
|
17761
|
-
fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
|
|
17774
|
+
fragment('<div class="html-error">%s</div>', test.err.htmlMessage),
|
|
17762
17775
|
);
|
|
17763
17776
|
} else {
|
|
17764
17777
|
el.appendChild(
|
|
17765
|
-
fragment('<pre class="error">%e%e</pre>', message, stackString)
|
|
17778
|
+
fragment('<pre class="error">%e%e</pre>', message, stackString),
|
|
17766
17779
|
);
|
|
17767
17780
|
}
|
|
17768
17781
|
|
|
@@ -17774,7 +17787,7 @@
|
|
|
17774
17787
|
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
17775
17788
|
var el = fragment(
|
|
17776
17789
|
'<li class="test pass pending"><h2>%e</h2></li>',
|
|
17777
|
-
test.title
|
|
17790
|
+
test.title,
|
|
17778
17791
|
);
|
|
17779
17792
|
appendToStack(el);
|
|
17780
17793
|
updateStats();
|
|
@@ -17797,18 +17810,22 @@
|
|
|
17797
17810
|
var decimalPlaces = Math.ceil(Math.log10(runner.total / 100));
|
|
17798
17811
|
text(
|
|
17799
17812
|
progressText,
|
|
17800
|
-
percent.toFixed(Math.min(Math.max(decimalPlaces, 0), 100)) +
|
|
17813
|
+
percent.toFixed(Math.min(Math.max(decimalPlaces, 0), 100)) + "%",
|
|
17801
17814
|
);
|
|
17802
17815
|
}
|
|
17803
17816
|
if (progressRing) {
|
|
17804
|
-
var radius = parseFloat(
|
|
17817
|
+
var radius = parseFloat(
|
|
17818
|
+
getComputedStyle(progressRing[0]).getPropertyValue("r"),
|
|
17819
|
+
);
|
|
17805
17820
|
var wholeArc = Math.PI * 2 * radius;
|
|
17806
17821
|
var highlightArc = percent * (wholeArc / 100);
|
|
17807
17822
|
// The progress ring is in 2 parts, the flatlight color and highlight color.
|
|
17808
17823
|
// Rendering both on top of the other, seems to make a 3rd color on the edges.
|
|
17809
17824
|
// To create 1 whole ring with 2 colors, both parts are inverse of the other.
|
|
17810
|
-
progressRing[0].style[
|
|
17811
|
-
|
|
17825
|
+
progressRing[0].style["stroke-dasharray"] =
|
|
17826
|
+
`0,${highlightArc}px,${wholeArc}px`;
|
|
17827
|
+
progressRing[1].style["stroke-dasharray"] =
|
|
17828
|
+
`${highlightArc}px,${wholeArc}px`;
|
|
17812
17829
|
}
|
|
17813
17830
|
|
|
17814
17831
|
// update stats
|
|
@@ -17830,13 +17847,15 @@
|
|
|
17830
17847
|
|
|
17831
17848
|
// Remove previous {grep, fgrep, invert} query parameters if present
|
|
17832
17849
|
if (search) {
|
|
17833
|
-
search = search
|
|
17850
|
+
search = search
|
|
17851
|
+
.replace(/[?&](?:f?grep|invert)=[^&\s]*/g, "")
|
|
17852
|
+
.replace(/^&/, "?");
|
|
17834
17853
|
}
|
|
17835
17854
|
|
|
17836
17855
|
return (
|
|
17837
17856
|
window.location.pathname +
|
|
17838
|
-
(search ? search +
|
|
17839
|
-
|
|
17857
|
+
(search ? search + "&" : "?") +
|
|
17858
|
+
"grep=" +
|
|
17840
17859
|
encodeURIComponent(s)
|
|
17841
17860
|
);
|
|
17842
17861
|
}
|
|
@@ -17847,7 +17866,7 @@
|
|
|
17847
17866
|
* @param {Object} [suite]
|
|
17848
17867
|
*/
|
|
17849
17868
|
HTML.prototype.suiteURL = function (suite) {
|
|
17850
|
-
return makeUrl(
|
|
17869
|
+
return makeUrl("^" + escapeRe(suite.fullTitle()) + " ");
|
|
17851
17870
|
};
|
|
17852
17871
|
|
|
17853
17872
|
/**
|
|
@@ -17856,7 +17875,7 @@
|
|
|
17856
17875
|
* @param {Object} [test]
|
|
17857
17876
|
*/
|
|
17858
17877
|
HTML.prototype.testURL = function (test) {
|
|
17859
|
-
return makeUrl(
|
|
17878
|
+
return makeUrl("^" + escapeRe(test.fullTitle()) + "$");
|
|
17860
17879
|
};
|
|
17861
17880
|
|
|
17862
17881
|
/**
|
|
@@ -17866,15 +17885,15 @@
|
|
|
17866
17885
|
* @param {string} contents
|
|
17867
17886
|
*/
|
|
17868
17887
|
HTML.prototype.addCodeToggle = function (el, contents) {
|
|
17869
|
-
var h2 = el.getElementsByTagName(
|
|
17888
|
+
var h2 = el.getElementsByTagName("h2")[0];
|
|
17870
17889
|
|
|
17871
|
-
on(h2,
|
|
17872
|
-
pre.style.display = pre.style.display ===
|
|
17890
|
+
on(h2, "click", function () {
|
|
17891
|
+
pre.style.display = pre.style.display === "none" ? "block" : "none";
|
|
17873
17892
|
});
|
|
17874
17893
|
|
|
17875
|
-
var pre = fragment(
|
|
17894
|
+
var pre = fragment("<pre><code>%e</code></pre>", utils.clean(contents));
|
|
17876
17895
|
el.appendChild(pre);
|
|
17877
|
-
pre.style.display =
|
|
17896
|
+
pre.style.display = "none";
|
|
17878
17897
|
};
|
|
17879
17898
|
|
|
17880
17899
|
/**
|
|
@@ -17893,14 +17912,14 @@
|
|
|
17893
17912
|
*/
|
|
17894
17913
|
function fragment(html) {
|
|
17895
17914
|
var args = arguments;
|
|
17896
|
-
var div = document.createElement(
|
|
17915
|
+
var div = document.createElement("div");
|
|
17897
17916
|
var i = 1;
|
|
17898
17917
|
|
|
17899
17918
|
div.innerHTML = html.replace(/%([se])/g, function (_, type) {
|
|
17900
17919
|
switch (type) {
|
|
17901
|
-
case
|
|
17920
|
+
case "s":
|
|
17902
17921
|
return String(args[i++]);
|
|
17903
|
-
case
|
|
17922
|
+
case "e":
|
|
17904
17923
|
return escape(args[i++]);
|
|
17905
17924
|
// no default
|
|
17906
17925
|
}
|
|
@@ -17916,11 +17935,11 @@
|
|
|
17916
17935
|
* @param {text} classname
|
|
17917
17936
|
*/
|
|
17918
17937
|
function hideSuitesWithout(classname) {
|
|
17919
|
-
var suites = document.getElementsByClassName(
|
|
17938
|
+
var suites = document.getElementsByClassName("suite");
|
|
17920
17939
|
for (var i = 0; i < suites.length; i++) {
|
|
17921
17940
|
var els = suites[i].getElementsByClassName(classname);
|
|
17922
17941
|
if (!els.length) {
|
|
17923
|
-
suites[i].className +=
|
|
17942
|
+
suites[i].className += " hidden";
|
|
17924
17943
|
}
|
|
17925
17944
|
}
|
|
17926
17945
|
}
|
|
@@ -17929,9 +17948,9 @@
|
|
|
17929
17948
|
* Unhide .hidden suites.
|
|
17930
17949
|
*/
|
|
17931
17950
|
function unhide() {
|
|
17932
|
-
var els = document.getElementsByClassName(
|
|
17951
|
+
var els = document.getElementsByClassName("suite hidden");
|
|
17933
17952
|
while (els.length > 0) {
|
|
17934
|
-
els[0].className = els[0].className.replace(
|
|
17953
|
+
els[0].className = els[0].className.replace("suite hidden", "suite");
|
|
17935
17954
|
}
|
|
17936
17955
|
}
|
|
17937
17956
|
|
|
@@ -17956,7 +17975,7 @@
|
|
|
17956
17975
|
if (el.addEventListener) {
|
|
17957
17976
|
el.addEventListener(event, fn, false);
|
|
17958
17977
|
} else {
|
|
17959
|
-
el.attachEvent(
|
|
17978
|
+
el.attachEvent("on" + event, fn);
|
|
17960
17979
|
}
|
|
17961
17980
|
}
|
|
17962
17981
|
|
|
@@ -18017,26 +18036,26 @@
|
|
|
18017
18036
|
});
|
|
18018
18037
|
|
|
18019
18038
|
runner.on(EVENT_TEST_BEGIN, function (test) {
|
|
18020
|
-
process.stdout.write(color(
|
|
18039
|
+
process.stdout.write(color("pass", " " + test.fullTitle() + ": "));
|
|
18021
18040
|
});
|
|
18022
18041
|
|
|
18023
18042
|
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
18024
|
-
var fmt = color(
|
|
18043
|
+
var fmt = color("checkmark", " -") + color("pending", " %s");
|
|
18025
18044
|
Base.consoleLog(fmt, test.fullTitle());
|
|
18026
18045
|
});
|
|
18027
18046
|
|
|
18028
18047
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
18029
18048
|
var fmt =
|
|
18030
|
-
color(
|
|
18031
|
-
color(
|
|
18032
|
-
color(test.speed,
|
|
18049
|
+
color("checkmark", " " + Base.symbols.ok) +
|
|
18050
|
+
color("pass", " %s: ") +
|
|
18051
|
+
color(test.speed, "%dms");
|
|
18033
18052
|
cursor.CR();
|
|
18034
18053
|
Base.consoleLog(fmt, test.fullTitle(), test.duration);
|
|
18035
18054
|
});
|
|
18036
18055
|
|
|
18037
18056
|
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
18038
18057
|
cursor.CR();
|
|
18039
|
-
Base.consoleLog(color(
|
|
18058
|
+
Base.consoleLog(color("fail", " %d) %s"), ++n, test.fullTitle());
|
|
18040
18059
|
});
|
|
18041
18060
|
|
|
18042
18061
|
runner.once(EVENT_RUN_END, self.epilogue.bind(self));
|
|
@@ -18095,9 +18114,9 @@
|
|
|
18095
18114
|
|
|
18096
18115
|
runner.on(EVENT_RUN_BEGIN, function () {
|
|
18097
18116
|
// clear screen
|
|
18098
|
-
process.stdout.write(
|
|
18117
|
+
process.stdout.write("\u001b[2J");
|
|
18099
18118
|
// set cursor position
|
|
18100
|
-
process.stdout.write(
|
|
18119
|
+
process.stdout.write("\u001b[1;3H");
|
|
18101
18120
|
});
|
|
18102
18121
|
|
|
18103
18122
|
runner.once(EVENT_RUN_END, this.epilogue.bind(this));
|
|
@@ -18108,7 +18127,7 @@
|
|
|
18108
18127
|
*/
|
|
18109
18128
|
inherits(Min, Base);
|
|
18110
18129
|
|
|
18111
|
-
Min.description =
|
|
18130
|
+
Min.description = "essentially just a summary";
|
|
18112
18131
|
}(min));
|
|
18113
18132
|
|
|
18114
18133
|
var spec = {exports: {}};
|
|
@@ -18163,7 +18182,7 @@
|
|
|
18163
18182
|
var n = 0;
|
|
18164
18183
|
|
|
18165
18184
|
function indent() {
|
|
18166
|
-
return Array(indents).join(
|
|
18185
|
+
return Array(indents).join(" ");
|
|
18167
18186
|
}
|
|
18168
18187
|
|
|
18169
18188
|
runner.on(EVENT_RUN_BEGIN, function () {
|
|
@@ -18172,7 +18191,7 @@
|
|
|
18172
18191
|
|
|
18173
18192
|
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
18174
18193
|
++indents;
|
|
18175
|
-
Base.consoleLog(color(
|
|
18194
|
+
Base.consoleLog(color("suite", "%s%s"), indent(), suite.title);
|
|
18176
18195
|
});
|
|
18177
18196
|
|
|
18178
18197
|
runner.on(EVENT_SUITE_END, function () {
|
|
@@ -18183,30 +18202,30 @@
|
|
|
18183
18202
|
});
|
|
18184
18203
|
|
|
18185
18204
|
runner.on(EVENT_TEST_PENDING, function (test) {
|
|
18186
|
-
var fmt = indent() + color(
|
|
18205
|
+
var fmt = indent() + color("pending", " - %s");
|
|
18187
18206
|
Base.consoleLog(fmt, test.title);
|
|
18188
18207
|
});
|
|
18189
18208
|
|
|
18190
18209
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
18191
18210
|
var fmt;
|
|
18192
|
-
if (test.speed ===
|
|
18211
|
+
if (test.speed === "fast") {
|
|
18193
18212
|
fmt =
|
|
18194
18213
|
indent() +
|
|
18195
|
-
color(
|
|
18196
|
-
color(
|
|
18214
|
+
color("checkmark", " " + Base.symbols.ok) +
|
|
18215
|
+
color("pass", " %s");
|
|
18197
18216
|
Base.consoleLog(fmt, test.title);
|
|
18198
18217
|
} else {
|
|
18199
18218
|
fmt =
|
|
18200
18219
|
indent() +
|
|
18201
|
-
color(
|
|
18202
|
-
color(
|
|
18203
|
-
color(test.speed,
|
|
18220
|
+
color("checkmark", " " + Base.symbols.ok) +
|
|
18221
|
+
color("pass", " %s") +
|
|
18222
|
+
color(test.speed, " (%dms)");
|
|
18204
18223
|
Base.consoleLog(fmt, test.title, test.duration);
|
|
18205
18224
|
}
|
|
18206
18225
|
});
|
|
18207
18226
|
|
|
18208
18227
|
runner.on(EVENT_TEST_FAIL, function (test) {
|
|
18209
|
-
Base.consoleLog(indent() + color(
|
|
18228
|
+
Base.consoleLog(indent() + color("fail", " %d) %s"), ++n, test.title);
|
|
18210
18229
|
});
|
|
18211
18230
|
|
|
18212
18231
|
runner.once(EVENT_RUN_END, self.epilogue.bind(self));
|
|
@@ -18217,7 +18236,7 @@
|
|
|
18217
18236
|
*/
|
|
18218
18237
|
inherits(Spec, Base);
|
|
18219
18238
|
|
|
18220
|
-
Spec.description =
|
|
18239
|
+
Spec.description = "hierarchical & verbose [default]";
|
|
18221
18240
|
}(spec));
|
|
18222
18241
|
|
|
18223
18242
|
var nyan = {exports: {}};
|
|
@@ -18295,7 +18314,7 @@
|
|
|
18295
18314
|
runner.once(EVENT_RUN_END, function () {
|
|
18296
18315
|
Base.cursor.show();
|
|
18297
18316
|
for (var i = 0; i < self.numberOfLines; i++) {
|
|
18298
|
-
process.stdout.write(
|
|
18317
|
+
process.stdout.write("\n");
|
|
18299
18318
|
}
|
|
18300
18319
|
self.epilogue();
|
|
18301
18320
|
});
|
|
@@ -18331,15 +18350,15 @@
|
|
|
18331
18350
|
var stats = this.stats;
|
|
18332
18351
|
|
|
18333
18352
|
function draw(type, n) {
|
|
18334
|
-
process.stdout.write(
|
|
18353
|
+
process.stdout.write(" ");
|
|
18335
18354
|
process.stdout.write(Base.color(type, n));
|
|
18336
|
-
process.stdout.write(
|
|
18355
|
+
process.stdout.write("\n");
|
|
18337
18356
|
}
|
|
18338
18357
|
|
|
18339
|
-
draw(
|
|
18340
|
-
draw(
|
|
18341
|
-
draw(
|
|
18342
|
-
process.stdout.write(
|
|
18358
|
+
draw("green", stats.passes);
|
|
18359
|
+
draw("fail", stats.failures);
|
|
18360
|
+
draw("pending", stats.pending);
|
|
18361
|
+
process.stdout.write("\n");
|
|
18343
18362
|
|
|
18344
18363
|
this.cursorUp(this.numberOfLines);
|
|
18345
18364
|
};
|
|
@@ -18351,7 +18370,7 @@
|
|
|
18351
18370
|
*/
|
|
18352
18371
|
|
|
18353
18372
|
NyanCat.prototype.appendRainbow = function () {
|
|
18354
|
-
var segment = this.tick ?
|
|
18373
|
+
var segment = this.tick ? "_" : "-";
|
|
18355
18374
|
var rainbowified = this.rainbowify(segment);
|
|
18356
18375
|
|
|
18357
18376
|
for (var index = 0; index < this.numberOfLines; index++) {
|
|
@@ -18373,9 +18392,9 @@
|
|
|
18373
18392
|
var self = this;
|
|
18374
18393
|
|
|
18375
18394
|
this.trajectories.forEach(function (line) {
|
|
18376
|
-
process.stdout.write(
|
|
18377
|
-
process.stdout.write(line.join(
|
|
18378
|
-
process.stdout.write(
|
|
18395
|
+
process.stdout.write("\u001b[" + self.scoreboardWidth + "C");
|
|
18396
|
+
process.stdout.write(line.join(""));
|
|
18397
|
+
process.stdout.write("\n");
|
|
18379
18398
|
});
|
|
18380
18399
|
|
|
18381
18400
|
this.cursorUp(this.numberOfLines);
|
|
@@ -18389,28 +18408,28 @@
|
|
|
18389
18408
|
NyanCat.prototype.drawNyanCat = function () {
|
|
18390
18409
|
var self = this;
|
|
18391
18410
|
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
|
|
18392
|
-
var dist =
|
|
18393
|
-
var padding =
|
|
18411
|
+
var dist = "\u001b[" + startWidth + "C";
|
|
18412
|
+
var padding = "";
|
|
18394
18413
|
|
|
18395
18414
|
process.stdout.write(dist);
|
|
18396
|
-
process.stdout.write(
|
|
18397
|
-
process.stdout.write(
|
|
18415
|
+
process.stdout.write("_,------,");
|
|
18416
|
+
process.stdout.write("\n");
|
|
18398
18417
|
|
|
18399
18418
|
process.stdout.write(dist);
|
|
18400
|
-
padding = self.tick ?
|
|
18401
|
-
process.stdout.write(
|
|
18402
|
-
process.stdout.write(
|
|
18419
|
+
padding = self.tick ? " " : " ";
|
|
18420
|
+
process.stdout.write("_|" + padding + "/\\_/\\ ");
|
|
18421
|
+
process.stdout.write("\n");
|
|
18403
18422
|
|
|
18404
18423
|
process.stdout.write(dist);
|
|
18405
|
-
padding = self.tick ?
|
|
18406
|
-
var tail = self.tick ?
|
|
18407
|
-
process.stdout.write(tail +
|
|
18408
|
-
process.stdout.write(
|
|
18424
|
+
padding = self.tick ? "_" : "__";
|
|
18425
|
+
var tail = self.tick ? "~" : "^";
|
|
18426
|
+
process.stdout.write(tail + "|" + padding + this.face() + " ");
|
|
18427
|
+
process.stdout.write("\n");
|
|
18409
18428
|
|
|
18410
18429
|
process.stdout.write(dist);
|
|
18411
|
-
padding = self.tick ?
|
|
18430
|
+
padding = self.tick ? " " : " ";
|
|
18412
18431
|
process.stdout.write(padding + '"" "" ');
|
|
18413
|
-
process.stdout.write(
|
|
18432
|
+
process.stdout.write("\n");
|
|
18414
18433
|
|
|
18415
18434
|
this.cursorUp(this.numberOfLines);
|
|
18416
18435
|
};
|
|
@@ -18425,13 +18444,13 @@
|
|
|
18425
18444
|
NyanCat.prototype.face = function () {
|
|
18426
18445
|
var stats = this.stats;
|
|
18427
18446
|
if (stats.failures) {
|
|
18428
|
-
return
|
|
18447
|
+
return "( x .x)";
|
|
18429
18448
|
} else if (stats.pending) {
|
|
18430
|
-
return
|
|
18449
|
+
return "( o .o)";
|
|
18431
18450
|
} else if (stats.passes) {
|
|
18432
|
-
return
|
|
18451
|
+
return "( ^ .^)";
|
|
18433
18452
|
}
|
|
18434
|
-
return
|
|
18453
|
+
return "( - .-)";
|
|
18435
18454
|
};
|
|
18436
18455
|
|
|
18437
18456
|
/**
|
|
@@ -18442,7 +18461,7 @@
|
|
|
18442
18461
|
*/
|
|
18443
18462
|
|
|
18444
18463
|
NyanCat.prototype.cursorUp = function (n) {
|
|
18445
|
-
process.stdout.write(
|
|
18464
|
+
process.stdout.write("\u001b[" + n + "A");
|
|
18446
18465
|
};
|
|
18447
18466
|
|
|
18448
18467
|
/**
|
|
@@ -18453,7 +18472,7 @@
|
|
|
18453
18472
|
*/
|
|
18454
18473
|
|
|
18455
18474
|
NyanCat.prototype.cursorDown = function (n) {
|
|
18456
|
-
process.stdout.write(
|
|
18475
|
+
process.stdout.write("\u001b[" + n + "B");
|
|
18457
18476
|
};
|
|
18458
18477
|
|
|
18459
18478
|
/**
|
|
@@ -18490,7 +18509,7 @@
|
|
|
18490
18509
|
}
|
|
18491
18510
|
var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
|
|
18492
18511
|
this.colorIndex += 1;
|
|
18493
|
-
return
|
|
18512
|
+
return "\u001b[38;5;" + color + "m" + str + "\u001b[0m";
|
|
18494
18513
|
};
|
|
18495
18514
|
|
|
18496
18515
|
NyanCat.description = '"nyan cat"';
|
|
@@ -18559,16 +18578,16 @@
|
|
|
18559
18578
|
var suiteName;
|
|
18560
18579
|
|
|
18561
18580
|
// the default name of the test suite if none is provided
|
|
18562
|
-
var DEFAULT_SUITE_NAME =
|
|
18581
|
+
var DEFAULT_SUITE_NAME = "Mocha Tests";
|
|
18563
18582
|
|
|
18564
18583
|
if (options && options.reporterOptions) {
|
|
18565
18584
|
if (options.reporterOptions.output) {
|
|
18566
18585
|
if (!fs.createWriteStream) {
|
|
18567
|
-
throw createUnsupportedError(
|
|
18586
|
+
throw createUnsupportedError("file output not supported in browser");
|
|
18568
18587
|
}
|
|
18569
18588
|
|
|
18570
18589
|
fs.mkdirSync(path.dirname(options.reporterOptions.output), {
|
|
18571
|
-
recursive: true
|
|
18590
|
+
recursive: true,
|
|
18572
18591
|
});
|
|
18573
18592
|
self.fileStream = fs.createWriteStream(options.reporterOptions.output);
|
|
18574
18593
|
}
|
|
@@ -18595,7 +18614,7 @@
|
|
|
18595
18614
|
runner.once(EVENT_RUN_END, function () {
|
|
18596
18615
|
self.write(
|
|
18597
18616
|
tag(
|
|
18598
|
-
|
|
18617
|
+
"testsuite",
|
|
18599
18618
|
{
|
|
18600
18619
|
name: suiteName,
|
|
18601
18620
|
tests: stats.tests,
|
|
@@ -18603,17 +18622,17 @@
|
|
|
18603
18622
|
errors: stats.failures,
|
|
18604
18623
|
skipped: stats.tests - stats.failures - stats.passes,
|
|
18605
18624
|
timestamp: new Date().toUTCString(),
|
|
18606
|
-
time: stats.duration / 1000 || 0
|
|
18625
|
+
time: stats.duration / 1000 || 0,
|
|
18607
18626
|
},
|
|
18608
|
-
false
|
|
18609
|
-
)
|
|
18627
|
+
false,
|
|
18628
|
+
),
|
|
18610
18629
|
);
|
|
18611
18630
|
|
|
18612
18631
|
tests.forEach(function (t) {
|
|
18613
18632
|
self.test(t, options);
|
|
18614
18633
|
});
|
|
18615
18634
|
|
|
18616
|
-
self.write(
|
|
18635
|
+
self.write("</testsuite>");
|
|
18617
18636
|
});
|
|
18618
18637
|
}
|
|
18619
18638
|
|
|
@@ -18645,9 +18664,9 @@
|
|
|
18645
18664
|
*/
|
|
18646
18665
|
XUnit.prototype.write = function (line) {
|
|
18647
18666
|
if (this.fileStream) {
|
|
18648
|
-
this.fileStream.write(line +
|
|
18649
|
-
} else if (typeof process ===
|
|
18650
|
-
process.stdout.write(line +
|
|
18667
|
+
this.fileStream.write(line + "\n");
|
|
18668
|
+
} else if (typeof process === "object" && process.stdout) {
|
|
18669
|
+
process.stdout.write(line + "\n");
|
|
18651
18670
|
} else {
|
|
18652
18671
|
Base.consoleLog(line);
|
|
18653
18672
|
}
|
|
@@ -18665,32 +18684,32 @@
|
|
|
18665
18684
|
classname: test.parent.fullTitle(),
|
|
18666
18685
|
name: test.title,
|
|
18667
18686
|
file: testFilePath(test.file, options),
|
|
18668
|
-
time: test.duration / 1000 || 0
|
|
18687
|
+
time: test.duration / 1000 || 0,
|
|
18669
18688
|
};
|
|
18670
18689
|
|
|
18671
18690
|
if (test.state === STATE_FAILED) {
|
|
18672
18691
|
var err = test.err;
|
|
18673
18692
|
var diff =
|
|
18674
18693
|
!Base.hideDiff && Base.showDiff(err)
|
|
18675
|
-
?
|
|
18676
|
-
:
|
|
18694
|
+
? "\n" + Base.generateDiff(err.actual, err.expected)
|
|
18695
|
+
: "";
|
|
18677
18696
|
this.write(
|
|
18678
18697
|
tag(
|
|
18679
|
-
|
|
18698
|
+
"testcase",
|
|
18680
18699
|
attrs,
|
|
18681
18700
|
false,
|
|
18682
18701
|
tag(
|
|
18683
|
-
|
|
18702
|
+
"failure",
|
|
18684
18703
|
{},
|
|
18685
18704
|
false,
|
|
18686
|
-
escape(err.message) + escape(diff) +
|
|
18687
|
-
)
|
|
18688
|
-
)
|
|
18705
|
+
escape(err.message) + escape(diff) + "\n" + escape(err.stack),
|
|
18706
|
+
),
|
|
18707
|
+
),
|
|
18689
18708
|
);
|
|
18690
18709
|
} else if (test.isPending()) {
|
|
18691
|
-
this.write(tag(
|
|
18710
|
+
this.write(tag("testcase", attrs, false, tag("skipped", {}, true)));
|
|
18692
18711
|
} else {
|
|
18693
|
-
this.write(tag(
|
|
18712
|
+
this.write(tag("testcase", attrs, true));
|
|
18694
18713
|
}
|
|
18695
18714
|
};
|
|
18696
18715
|
|
|
@@ -18704,7 +18723,7 @@
|
|
|
18704
18723
|
* @return {string}
|
|
18705
18724
|
*/
|
|
18706
18725
|
function tag(name, attrs, close, content) {
|
|
18707
|
-
var end = close ?
|
|
18726
|
+
var end = close ? "/>" : ">";
|
|
18708
18727
|
var pairs = [];
|
|
18709
18728
|
var tag;
|
|
18710
18729
|
|
|
@@ -18714,22 +18733,26 @@
|
|
|
18714
18733
|
}
|
|
18715
18734
|
}
|
|
18716
18735
|
|
|
18717
|
-
tag =
|
|
18736
|
+
tag = "<" + name + (pairs.length ? " " + pairs.join(" ") : "") + end;
|
|
18718
18737
|
if (content) {
|
|
18719
|
-
tag += content +
|
|
18738
|
+
tag += content + "</" + name + end;
|
|
18720
18739
|
}
|
|
18721
18740
|
return tag;
|
|
18722
18741
|
}
|
|
18723
18742
|
|
|
18724
18743
|
function testFilePath(filepath, options) {
|
|
18725
|
-
if (
|
|
18744
|
+
if (
|
|
18745
|
+
options &&
|
|
18746
|
+
options.reporterOptions &&
|
|
18747
|
+
options.reporterOptions.showRelativePaths
|
|
18748
|
+
) {
|
|
18726
18749
|
return path.relative(process.cwd(), filepath);
|
|
18727
18750
|
}
|
|
18728
18751
|
|
|
18729
18752
|
return filepath;
|
|
18730
18753
|
}
|
|
18731
18754
|
|
|
18732
|
-
XUnit.description =
|
|
18755
|
+
XUnit.description = "XUnit-compatible XML output";
|
|
18733
18756
|
}(xunit));
|
|
18734
18757
|
|
|
18735
18758
|
var markdown = {exports: {}};
|
|
@@ -18759,7 +18782,7 @@
|
|
|
18759
18782
|
* Constants
|
|
18760
18783
|
*/
|
|
18761
18784
|
|
|
18762
|
-
var SUITE_PREFIX =
|
|
18785
|
+
var SUITE_PREFIX = "$";
|
|
18763
18786
|
|
|
18764
18787
|
/**
|
|
18765
18788
|
* Expose `Markdown`.
|
|
@@ -18781,17 +18804,17 @@
|
|
|
18781
18804
|
Base.call(this, runner, options);
|
|
18782
18805
|
|
|
18783
18806
|
var level = 0;
|
|
18784
|
-
var buf =
|
|
18807
|
+
var buf = "";
|
|
18785
18808
|
|
|
18786
18809
|
function title(str) {
|
|
18787
|
-
return Array(level).join(
|
|
18810
|
+
return Array(level).join("#") + " " + str;
|
|
18788
18811
|
}
|
|
18789
18812
|
|
|
18790
18813
|
function mapTOC(suite, obj) {
|
|
18791
18814
|
var ret = obj;
|
|
18792
18815
|
var key = SUITE_PREFIX + suite.title;
|
|
18793
18816
|
|
|
18794
|
-
obj = obj[key] = obj[key] || {suite};
|
|
18817
|
+
obj = obj[key] = obj[key] || { suite };
|
|
18795
18818
|
suite.suites.forEach(function (suite) {
|
|
18796
18819
|
mapTOC(suite, obj);
|
|
18797
18820
|
});
|
|
@@ -18801,16 +18824,16 @@
|
|
|
18801
18824
|
|
|
18802
18825
|
function stringifyTOC(obj, level) {
|
|
18803
18826
|
++level;
|
|
18804
|
-
var buf =
|
|
18827
|
+
var buf = "";
|
|
18805
18828
|
var link;
|
|
18806
18829
|
for (var key in obj) {
|
|
18807
|
-
if (key ===
|
|
18830
|
+
if (key === "suite") {
|
|
18808
18831
|
continue;
|
|
18809
18832
|
}
|
|
18810
18833
|
if (key !== SUITE_PREFIX) {
|
|
18811
|
-
link =
|
|
18812
|
-
link +=
|
|
18813
|
-
buf += Array(level).join(
|
|
18834
|
+
link = " - [" + key.substring(1) + "]";
|
|
18835
|
+
link += "(#" + utils.slug(obj[key].suite.fullTitle()) + ")\n";
|
|
18836
|
+
buf += Array(level).join(" ") + link;
|
|
18814
18837
|
}
|
|
18815
18838
|
buf += stringifyTOC(obj[key], level);
|
|
18816
18839
|
}
|
|
@@ -18827,8 +18850,8 @@
|
|
|
18827
18850
|
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
|
18828
18851
|
++level;
|
|
18829
18852
|
var slug = utils.slug(suite.fullTitle());
|
|
18830
|
-
buf += '<a name="' + slug + '"></a>' +
|
|
18831
|
-
buf += title(suite.title) +
|
|
18853
|
+
buf += '<a name="' + slug + '"></a>' + "\n";
|
|
18854
|
+
buf += title(suite.title) + "\n";
|
|
18832
18855
|
});
|
|
18833
18856
|
|
|
18834
18857
|
runner.on(EVENT_SUITE_END, function () {
|
|
@@ -18837,20 +18860,20 @@
|
|
|
18837
18860
|
|
|
18838
18861
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
18839
18862
|
var code = utils.clean(test.body);
|
|
18840
|
-
buf += test.title +
|
|
18841
|
-
buf +=
|
|
18842
|
-
buf += code +
|
|
18843
|
-
buf +=
|
|
18863
|
+
buf += test.title + ".\n";
|
|
18864
|
+
buf += "\n```js\n";
|
|
18865
|
+
buf += code + "\n";
|
|
18866
|
+
buf += "```\n\n";
|
|
18844
18867
|
});
|
|
18845
18868
|
|
|
18846
18869
|
runner.once(EVENT_RUN_END, function () {
|
|
18847
|
-
process.stdout.write(
|
|
18870
|
+
process.stdout.write("# TOC\n");
|
|
18848
18871
|
process.stdout.write(generateTOC(runner.suite));
|
|
18849
18872
|
process.stdout.write(buf);
|
|
18850
18873
|
});
|
|
18851
18874
|
}
|
|
18852
18875
|
|
|
18853
|
-
Markdown.description =
|
|
18876
|
+
Markdown.description = "GitHub Flavored Markdown";
|
|
18854
18877
|
}(markdown));
|
|
18855
18878
|
|
|
18856
18879
|
var progress = {exports: {}};
|
|
@@ -18912,15 +18935,15 @@
|
|
|
18912
18935
|
options = options || {};
|
|
18913
18936
|
var reporterOptions = options.reporterOptions || {};
|
|
18914
18937
|
|
|
18915
|
-
options.open = reporterOptions.open ||
|
|
18916
|
-
options.complete = reporterOptions.complete ||
|
|
18938
|
+
options.open = reporterOptions.open || "[";
|
|
18939
|
+
options.complete = reporterOptions.complete || "▬";
|
|
18917
18940
|
options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
|
|
18918
|
-
options.close = reporterOptions.close ||
|
|
18941
|
+
options.close = reporterOptions.close || "]";
|
|
18919
18942
|
options.verbose = reporterOptions.verbose || false;
|
|
18920
18943
|
|
|
18921
18944
|
// tests started
|
|
18922
18945
|
runner.on(EVENT_RUN_BEGIN, function () {
|
|
18923
|
-
process.stdout.write(
|
|
18946
|
+
process.stdout.write("\n");
|
|
18924
18947
|
cursor.hide();
|
|
18925
18948
|
});
|
|
18926
18949
|
|
|
@@ -18939,13 +18962,13 @@
|
|
|
18939
18962
|
lastN = n;
|
|
18940
18963
|
|
|
18941
18964
|
cursor.CR();
|
|
18942
|
-
process.stdout.write(
|
|
18943
|
-
process.stdout.write(color(
|
|
18965
|
+
process.stdout.write("\u001b[J");
|
|
18966
|
+
process.stdout.write(color("progress", " " + options.open));
|
|
18944
18967
|
process.stdout.write(Array(n).join(options.complete));
|
|
18945
18968
|
process.stdout.write(Array(i).join(options.incomplete));
|
|
18946
|
-
process.stdout.write(color(
|
|
18969
|
+
process.stdout.write(color("progress", options.close));
|
|
18947
18970
|
if (options.verbose) {
|
|
18948
|
-
process.stdout.write(color(
|
|
18971
|
+
process.stdout.write(color("progress", " " + complete + " of " + total));
|
|
18949
18972
|
}
|
|
18950
18973
|
});
|
|
18951
18974
|
|
|
@@ -18953,7 +18976,7 @@
|
|
|
18953
18976
|
// and the failures if any
|
|
18954
18977
|
runner.once(EVENT_RUN_END, function () {
|
|
18955
18978
|
cursor.show();
|
|
18956
|
-
process.stdout.write(
|
|
18979
|
+
process.stdout.write("\n");
|
|
18957
18980
|
self.epilogue();
|
|
18958
18981
|
});
|
|
18959
18982
|
}
|
|
@@ -18963,7 +18986,7 @@
|
|
|
18963
18986
|
*/
|
|
18964
18987
|
inherits(Progress, Base);
|
|
18965
18988
|
|
|
18966
|
-
Progress.description =
|
|
18989
|
+
Progress.description = "a progress bar";
|
|
18967
18990
|
}(progress));
|
|
18968
18991
|
|
|
18969
18992
|
var landing = {exports: {}};
|
|
@@ -19008,7 +19031,7 @@
|
|
|
19008
19031
|
* Airplane crash color.
|
|
19009
19032
|
*/
|
|
19010
19033
|
|
|
19011
|
-
Base.colors[
|
|
19034
|
+
Base.colors["plane crash"] = 31;
|
|
19012
19035
|
|
|
19013
19036
|
/**
|
|
19014
19037
|
* Runway color.
|
|
@@ -19033,18 +19056,18 @@
|
|
|
19033
19056
|
var width = (Base.window.width * 0.75) | 0;
|
|
19034
19057
|
var stream = process.stdout;
|
|
19035
19058
|
|
|
19036
|
-
var plane = color(
|
|
19059
|
+
var plane = color("plane", "✈");
|
|
19037
19060
|
var crashed = -1;
|
|
19038
19061
|
var n = 0;
|
|
19039
19062
|
var total = 0;
|
|
19040
19063
|
|
|
19041
19064
|
function runway() {
|
|
19042
|
-
var buf = Array(width).join(
|
|
19043
|
-
return
|
|
19065
|
+
var buf = Array(width).join("-");
|
|
19066
|
+
return " " + color("runway", buf);
|
|
19044
19067
|
}
|
|
19045
19068
|
|
|
19046
19069
|
runner.on(EVENT_RUN_BEGIN, function () {
|
|
19047
|
-
stream.write(
|
|
19070
|
+
stream.write("\n\n\n ");
|
|
19048
19071
|
cursor.hide();
|
|
19049
19072
|
});
|
|
19050
19073
|
|
|
@@ -19053,32 +19076,32 @@
|
|
|
19053
19076
|
var col = crashed === -1 ? ((width * ++n) / ++total) | 0 : crashed;
|
|
19054
19077
|
// show the crash
|
|
19055
19078
|
if (test.state === STATE_FAILED) {
|
|
19056
|
-
plane = color(
|
|
19079
|
+
plane = color("plane crash", "✈");
|
|
19057
19080
|
crashed = col;
|
|
19058
19081
|
}
|
|
19059
19082
|
|
|
19060
19083
|
// render landing strip
|
|
19061
|
-
stream.write(
|
|
19084
|
+
stream.write("\u001b[" + (width + 1) + "D\u001b[2A");
|
|
19062
19085
|
stream.write(runway());
|
|
19063
|
-
stream.write(
|
|
19064
|
-
stream.write(color(
|
|
19086
|
+
stream.write("\n ");
|
|
19087
|
+
stream.write(color("runway", Array(col).join("⋅")));
|
|
19065
19088
|
stream.write(plane);
|
|
19066
|
-
stream.write(color(
|
|
19089
|
+
stream.write(color("runway", Array(width - col).join("⋅") + "\n"));
|
|
19067
19090
|
stream.write(runway());
|
|
19068
|
-
stream.write(
|
|
19091
|
+
stream.write("\u001b[0m");
|
|
19069
19092
|
});
|
|
19070
19093
|
|
|
19071
19094
|
runner.once(EVENT_RUN_END, function () {
|
|
19072
19095
|
cursor.show();
|
|
19073
|
-
process.stdout.write(
|
|
19096
|
+
process.stdout.write("\n");
|
|
19074
19097
|
self.epilogue();
|
|
19075
19098
|
});
|
|
19076
19099
|
|
|
19077
19100
|
// if cursor is hidden when we ctrl-C, then it will remain hidden unless...
|
|
19078
|
-
process.once(
|
|
19101
|
+
process.once("SIGINT", function () {
|
|
19079
19102
|
cursor.show();
|
|
19080
19103
|
nextTick$1(function () {
|
|
19081
|
-
process.kill(process.pid,
|
|
19104
|
+
process.kill(process.pid, "SIGINT");
|
|
19082
19105
|
});
|
|
19083
19106
|
});
|
|
19084
19107
|
}
|
|
@@ -19088,7 +19111,7 @@
|
|
|
19088
19111
|
*/
|
|
19089
19112
|
inherits(Landing, Base);
|
|
19090
19113
|
|
|
19091
|
-
Landing.description =
|
|
19114
|
+
Landing.description = "Unicode landing strip";
|
|
19092
19115
|
}(landing));
|
|
19093
19116
|
|
|
19094
19117
|
var jsonStream = {exports: {}};
|
|
@@ -19137,22 +19160,22 @@
|
|
|
19137
19160
|
var total = runner.total;
|
|
19138
19161
|
|
|
19139
19162
|
runner.once(EVENT_RUN_BEGIN, function () {
|
|
19140
|
-
writeEvent([
|
|
19163
|
+
writeEvent(["start", { total }]);
|
|
19141
19164
|
});
|
|
19142
19165
|
|
|
19143
19166
|
runner.on(EVENT_TEST_PASS, function (test) {
|
|
19144
|
-
writeEvent([
|
|
19167
|
+
writeEvent(["pass", clean(test)]);
|
|
19145
19168
|
});
|
|
19146
19169
|
|
|
19147
19170
|
runner.on(EVENT_TEST_FAIL, function (test, err) {
|
|
19148
19171
|
test = clean(test);
|
|
19149
19172
|
test.err = err.message;
|
|
19150
19173
|
test.stack = err.stack || null;
|
|
19151
|
-
writeEvent([
|
|
19174
|
+
writeEvent(["fail", test]);
|
|
19152
19175
|
});
|
|
19153
19176
|
|
|
19154
19177
|
runner.once(EVENT_RUN_END, function () {
|
|
19155
|
-
writeEvent([
|
|
19178
|
+
writeEvent(["end", self.stats]);
|
|
19156
19179
|
});
|
|
19157
19180
|
}
|
|
19158
19181
|
|
|
@@ -19163,7 +19186,7 @@
|
|
|
19163
19186
|
* @param {unknown[]} event - Mocha event to be output.
|
|
19164
19187
|
*/
|
|
19165
19188
|
function writeEvent(event) {
|
|
19166
|
-
process.stdout.write(JSON.stringify(event) +
|
|
19189
|
+
process.stdout.write(JSON.stringify(event) + "\n");
|
|
19167
19190
|
}
|
|
19168
19191
|
|
|
19169
19192
|
/**
|
|
@@ -19181,11 +19204,11 @@
|
|
|
19181
19204
|
file: test.file,
|
|
19182
19205
|
duration: test.duration,
|
|
19183
19206
|
currentRetry: test.currentRetry(),
|
|
19184
|
-
speed: test.speed
|
|
19207
|
+
speed: test.speed,
|
|
19185
19208
|
};
|
|
19186
19209
|
}
|
|
19187
19210
|
|
|
19188
|
-
JSONStream.description =
|
|
19211
|
+
JSONStream.description = "newline delimited JSON events";
|
|
19189
19212
|
}(jsonStream));
|
|
19190
19213
|
|
|
19191
19214
|
(function (exports) {
|
|
@@ -19206,7 +19229,7 @@
|
|
|
19206
19229
|
exports.Markdown = exports.markdown = markdown.exports;
|
|
19207
19230
|
exports.Progress = exports.progress = progress.exports;
|
|
19208
19231
|
exports.Landing = exports.landing = landing.exports;
|
|
19209
|
-
exports.JSONStream = exports[
|
|
19232
|
+
exports.JSONStream = exports["json-stream"] = jsonStream.exports;
|
|
19210
19233
|
}(reporters));
|
|
19211
19234
|
|
|
19212
19235
|
var diff = true;
|
|
@@ -19270,11 +19293,11 @@
|
|
|
19270
19293
|
tests: 0,
|
|
19271
19294
|
passes: 0,
|
|
19272
19295
|
pending: 0,
|
|
19273
|
-
failures: 0
|
|
19296
|
+
failures: 0,
|
|
19274
19297
|
};
|
|
19275
19298
|
|
|
19276
19299
|
if (!runner) {
|
|
19277
|
-
throw new TypeError(
|
|
19300
|
+
throw new TypeError("Missing runner argument");
|
|
19278
19301
|
}
|
|
19279
19302
|
|
|
19280
19303
|
runner.stats = stats;
|
|
@@ -19315,7 +19338,7 @@
|
|
|
19315
19338
|
var createInvalidArgumentTypeError = errors$1.createInvalidArgumentTypeError;
|
|
19316
19339
|
var isString = utils.isString;
|
|
19317
19340
|
|
|
19318
|
-
const {MOCHA_ID_PROP_NAME} = utils.constants;
|
|
19341
|
+
const { MOCHA_ID_PROP_NAME } = utils.constants;
|
|
19319
19342
|
|
|
19320
19343
|
var test = Test$4;
|
|
19321
19344
|
|
|
@@ -19334,11 +19357,11 @@
|
|
|
19334
19357
|
'Test argument "title" should be a string. Received type "' +
|
|
19335
19358
|
typeof title +
|
|
19336
19359
|
'"',
|
|
19337
|
-
|
|
19338
|
-
|
|
19360
|
+
"title",
|
|
19361
|
+
"string",
|
|
19339
19362
|
);
|
|
19340
19363
|
}
|
|
19341
|
-
this.type =
|
|
19364
|
+
this.type = "test";
|
|
19342
19365
|
Runnable.call(this, title, fn);
|
|
19343
19366
|
this.reset();
|
|
19344
19367
|
}
|
|
@@ -19411,14 +19434,14 @@
|
|
|
19411
19434
|
err: this.err,
|
|
19412
19435
|
parent: {
|
|
19413
19436
|
$$fullTitle: this.parent.fullTitle(),
|
|
19414
|
-
[MOCHA_ID_PROP_NAME]: this.parent.id
|
|
19437
|
+
[MOCHA_ID_PROP_NAME]: this.parent.id,
|
|
19415
19438
|
},
|
|
19416
19439
|
speed: this.speed,
|
|
19417
19440
|
state: this.state,
|
|
19418
19441
|
title: this.title,
|
|
19419
19442
|
type: this.type,
|
|
19420
19443
|
file: this.file,
|
|
19421
|
-
[MOCHA_ID_PROP_NAME]: this.id
|
|
19444
|
+
[MOCHA_ID_PROP_NAME]: this.id,
|
|
19422
19445
|
};
|
|
19423
19446
|
};
|
|
19424
19447
|
|
|
@@ -19569,26 +19592,26 @@
|
|
|
19569
19592
|
mocha.options.forbidPending &&
|
|
19570
19593
|
shouldBeTested(suite)
|
|
19571
19594
|
) {
|
|
19572
|
-
throw createUnsupportedError(
|
|
19595
|
+
throw createUnsupportedError("Pending test forbidden");
|
|
19573
19596
|
}
|
|
19574
|
-
if (typeof opts.fn ===
|
|
19597
|
+
if (typeof opts.fn === "function") {
|
|
19575
19598
|
opts.fn.call(suite);
|
|
19576
19599
|
suites.shift();
|
|
19577
|
-
} else if (typeof opts.fn ===
|
|
19600
|
+
} else if (typeof opts.fn === "undefined" && !suite.pending) {
|
|
19578
19601
|
throw createMissingArgumentError(
|
|
19579
19602
|
'Suite "' +
|
|
19580
19603
|
suite.fullTitle() +
|
|
19581
19604
|
'" was defined but no callback was supplied. ' +
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19605
|
+
"Supply a callback or explicitly skip the suite.",
|
|
19606
|
+
"callback",
|
|
19607
|
+
"function",
|
|
19585
19608
|
);
|
|
19586
19609
|
} else if (!opts.fn && suite.pending) {
|
|
19587
19610
|
suites.shift();
|
|
19588
19611
|
}
|
|
19589
19612
|
|
|
19590
19613
|
return suite;
|
|
19591
|
-
}
|
|
19614
|
+
},
|
|
19592
19615
|
},
|
|
19593
19616
|
|
|
19594
19617
|
test: {
|
|
@@ -19614,8 +19637,8 @@
|
|
|
19614
19637
|
*/
|
|
19615
19638
|
skip: function (title) {
|
|
19616
19639
|
context.test(title);
|
|
19617
|
-
}
|
|
19618
|
-
}
|
|
19640
|
+
},
|
|
19641
|
+
},
|
|
19619
19642
|
};
|
|
19620
19643
|
};
|
|
19621
19644
|
|
|
@@ -19665,7 +19688,7 @@
|
|
|
19665
19688
|
return common$1.suite.create({
|
|
19666
19689
|
title,
|
|
19667
19690
|
file,
|
|
19668
|
-
fn
|
|
19691
|
+
fn,
|
|
19669
19692
|
});
|
|
19670
19693
|
};
|
|
19671
19694
|
|
|
@@ -19680,7 +19703,7 @@
|
|
|
19680
19703
|
return common$1.suite.skip({
|
|
19681
19704
|
title,
|
|
19682
19705
|
file,
|
|
19683
|
-
fn
|
|
19706
|
+
fn,
|
|
19684
19707
|
});
|
|
19685
19708
|
};
|
|
19686
19709
|
|
|
@@ -19692,7 +19715,7 @@
|
|
|
19692
19715
|
return common$1.suite.only({
|
|
19693
19716
|
title,
|
|
19694
19717
|
file,
|
|
19695
|
-
fn
|
|
19718
|
+
fn,
|
|
19696
19719
|
});
|
|
19697
19720
|
};
|
|
19698
19721
|
|
|
@@ -19734,7 +19757,7 @@
|
|
|
19734
19757
|
});
|
|
19735
19758
|
};
|
|
19736
19759
|
|
|
19737
|
-
bdd.exports.description =
|
|
19760
|
+
bdd.exports.description = "BDD or RSpec style [default]";
|
|
19738
19761
|
|
|
19739
19762
|
var tdd = {exports: {}};
|
|
19740
19763
|
|
|
@@ -19791,7 +19814,7 @@
|
|
|
19791
19814
|
return common$1.suite.create({
|
|
19792
19815
|
title,
|
|
19793
19816
|
file,
|
|
19794
|
-
fn
|
|
19817
|
+
fn,
|
|
19795
19818
|
});
|
|
19796
19819
|
};
|
|
19797
19820
|
|
|
@@ -19802,7 +19825,7 @@
|
|
|
19802
19825
|
return common$1.suite.skip({
|
|
19803
19826
|
title,
|
|
19804
19827
|
file,
|
|
19805
|
-
fn
|
|
19828
|
+
fn,
|
|
19806
19829
|
});
|
|
19807
19830
|
};
|
|
19808
19831
|
|
|
@@ -19813,7 +19836,7 @@
|
|
|
19813
19836
|
return common$1.suite.only({
|
|
19814
19837
|
title,
|
|
19815
19838
|
file,
|
|
19816
|
-
fn
|
|
19839
|
+
fn,
|
|
19817
19840
|
});
|
|
19818
19841
|
};
|
|
19819
19842
|
|
|
@@ -19904,7 +19927,7 @@
|
|
|
19904
19927
|
return common$1.suite.create({
|
|
19905
19928
|
title,
|
|
19906
19929
|
file,
|
|
19907
|
-
fn: false
|
|
19930
|
+
fn: false,
|
|
19908
19931
|
});
|
|
19909
19932
|
};
|
|
19910
19933
|
|
|
@@ -19919,7 +19942,7 @@
|
|
|
19919
19942
|
return common$1.suite.only({
|
|
19920
19943
|
title,
|
|
19921
19944
|
file,
|
|
19922
|
-
fn: false
|
|
19945
|
+
fn: false,
|
|
19923
19946
|
});
|
|
19924
19947
|
};
|
|
19925
19948
|
|
|
@@ -19948,7 +19971,7 @@
|
|
|
19948
19971
|
});
|
|
19949
19972
|
};
|
|
19950
19973
|
|
|
19951
|
-
qunit.exports.description =
|
|
19974
|
+
qunit.exports.description = "QUnit style";
|
|
19952
19975
|
|
|
19953
19976
|
var exports$1 = {exports: {}};
|
|
19954
19977
|
|
|
@@ -19980,19 +20003,19 @@
|
|
|
19980
20003
|
function visit(obj, file) {
|
|
19981
20004
|
var suite;
|
|
19982
20005
|
for (var key in obj) {
|
|
19983
|
-
if (typeof obj[key] ===
|
|
20006
|
+
if (typeof obj[key] === "function") {
|
|
19984
20007
|
var fn = obj[key];
|
|
19985
20008
|
switch (key) {
|
|
19986
|
-
case
|
|
20009
|
+
case "before":
|
|
19987
20010
|
suites[0].beforeAll(fn);
|
|
19988
20011
|
break;
|
|
19989
|
-
case
|
|
20012
|
+
case "after":
|
|
19990
20013
|
suites[0].afterAll(fn);
|
|
19991
20014
|
break;
|
|
19992
|
-
case
|
|
20015
|
+
case "beforeEach":
|
|
19993
20016
|
suites[0].beforeEach(fn);
|
|
19994
20017
|
break;
|
|
19995
|
-
case
|
|
20018
|
+
case "afterEach":
|
|
19996
20019
|
suites[0].afterEach(fn);
|
|
19997
20020
|
break;
|
|
19998
20021
|
default:
|
|
@@ -20108,7 +20131,7 @@
|
|
|
20108
20131
|
};
|
|
20109
20132
|
|
|
20110
20133
|
var name = "mocha";
|
|
20111
|
-
var version = "11.7.
|
|
20134
|
+
var version = "11.7.6";
|
|
20112
20135
|
var homepage = "https://mochajs.org/";
|
|
20113
20136
|
var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
|
|
20114
20137
|
var require$$17 = {
|
|
@@ -20139,11 +20162,11 @@
|
|
|
20139
20162
|
createInvalidInterfaceError,
|
|
20140
20163
|
createMochaInstanceAlreadyDisposedError,
|
|
20141
20164
|
createMochaInstanceAlreadyRunningError,
|
|
20142
|
-
createUnsupportedError
|
|
20165
|
+
createUnsupportedError,
|
|
20143
20166
|
} = errors$2;
|
|
20144
|
-
const {EVENT_FILE_PRE_REQUIRE, EVENT_FILE_POST_REQUIRE, EVENT_FILE_REQUIRE} =
|
|
20167
|
+
const { EVENT_FILE_PRE_REQUIRE, EVENT_FILE_POST_REQUIRE, EVENT_FILE_REQUIRE } =
|
|
20145
20168
|
Suite.constants;
|
|
20146
|
-
var debug = browser.exports(
|
|
20169
|
+
var debug = browser.exports("mocha:mocha");
|
|
20147
20170
|
|
|
20148
20171
|
/**
|
|
20149
20172
|
* @typedef {import('./types.d.ts').DoneCB} DoneCB
|
|
@@ -20165,32 +20188,32 @@
|
|
|
20165
20188
|
* Initial state of the mocha instance
|
|
20166
20189
|
* @private
|
|
20167
20190
|
*/
|
|
20168
|
-
INIT:
|
|
20191
|
+
INIT: "init",
|
|
20169
20192
|
/**
|
|
20170
20193
|
* Mocha instance is running tests
|
|
20171
20194
|
* @private
|
|
20172
20195
|
*/
|
|
20173
|
-
RUNNING:
|
|
20196
|
+
RUNNING: "running",
|
|
20174
20197
|
/**
|
|
20175
20198
|
* Mocha instance is done running tests and references to test functions and hooks are cleaned.
|
|
20176
20199
|
* You can reset this state by unloading the test files.
|
|
20177
20200
|
* @private
|
|
20178
20201
|
*/
|
|
20179
|
-
REFERENCES_CLEANED:
|
|
20202
|
+
REFERENCES_CLEANED: "referencesCleaned",
|
|
20180
20203
|
/**
|
|
20181
20204
|
* Mocha instance is disposed and can no longer be used.
|
|
20182
20205
|
* @private
|
|
20183
20206
|
*/
|
|
20184
|
-
DISPOSED:
|
|
20207
|
+
DISPOSED: "disposed",
|
|
20185
20208
|
});
|
|
20186
20209
|
|
|
20187
20210
|
/**
|
|
20188
20211
|
* To require local UIs and reporters when running in node.
|
|
20189
20212
|
*/
|
|
20190
20213
|
|
|
20191
|
-
if (!utils.isBrowser() && typeof module.paths !==
|
|
20214
|
+
if (!utils.isBrowser() && typeof module.paths !== "undefined") {
|
|
20192
20215
|
var cwd = utils.cwd();
|
|
20193
|
-
module.paths.push(cwd, path.join(cwd,
|
|
20216
|
+
module.paths.push(cwd, path.join(cwd, "node_modules"));
|
|
20194
20217
|
}
|
|
20195
20218
|
|
|
20196
20219
|
/**
|
|
@@ -20220,13 +20243,13 @@
|
|
|
20220
20243
|
exports.afterEach = function (...args) {
|
|
20221
20244
|
return (currentContext.afterEach || currentContext.teardown).apply(
|
|
20222
20245
|
this,
|
|
20223
|
-
args
|
|
20246
|
+
args,
|
|
20224
20247
|
);
|
|
20225
20248
|
};
|
|
20226
20249
|
exports.after = function (...args) {
|
|
20227
20250
|
return (currentContext.after || currentContext.suiteTeardown).apply(
|
|
20228
20251
|
this,
|
|
20229
|
-
args
|
|
20252
|
+
args,
|
|
20230
20253
|
);
|
|
20231
20254
|
};
|
|
20232
20255
|
exports.beforeEach = function (...args) {
|
|
@@ -20241,13 +20264,13 @@
|
|
|
20241
20264
|
exports.describe.only = function (...args) {
|
|
20242
20265
|
return (currentContext.describe || currentContext.suite).only.apply(
|
|
20243
20266
|
this,
|
|
20244
|
-
args
|
|
20267
|
+
args,
|
|
20245
20268
|
);
|
|
20246
20269
|
};
|
|
20247
20270
|
exports.describe.skip = function (...args) {
|
|
20248
20271
|
return (currentContext.describe || currentContext.suite).skip.apply(
|
|
20249
20272
|
this,
|
|
20250
|
-
args
|
|
20273
|
+
args,
|
|
20251
20274
|
);
|
|
20252
20275
|
};
|
|
20253
20276
|
exports.it = function (...args) {
|
|
@@ -20279,11 +20302,11 @@
|
|
|
20279
20302
|
* @param {MochaOptions} [options] - Settings object.
|
|
20280
20303
|
*/
|
|
20281
20304
|
function Mocha(options = {}) {
|
|
20282
|
-
options = {...mocharc, ...options};
|
|
20305
|
+
options = { ...mocharc, ...options };
|
|
20283
20306
|
this.files = [];
|
|
20284
20307
|
this.options = options;
|
|
20285
20308
|
// root suite
|
|
20286
|
-
this.suite = new exports.Suite(
|
|
20309
|
+
this.suite = new exports.Suite("", new exports.Context(), true);
|
|
20287
20310
|
this._cleanReferencesAfterRun = true;
|
|
20288
20311
|
this._state = mochaStates.INIT;
|
|
20289
20312
|
|
|
@@ -20292,38 +20315,38 @@
|
|
|
20292
20315
|
.ui(options.ui)
|
|
20293
20316
|
.reporter(
|
|
20294
20317
|
options.reporter,
|
|
20295
|
-
options[
|
|
20318
|
+
options["reporter-option"] ||
|
|
20296
20319
|
options.reporterOption ||
|
|
20297
|
-
options.reporterOptions // for backwards compatibility
|
|
20320
|
+
options.reporterOptions, // for backwards compatibility
|
|
20298
20321
|
)
|
|
20299
20322
|
.slow(options.slow)
|
|
20300
20323
|
.global(options.global);
|
|
20301
20324
|
|
|
20302
20325
|
// this guard exists because Suite#timeout does not consider `undefined` to be valid input
|
|
20303
|
-
if (typeof options.timeout !==
|
|
20326
|
+
if (typeof options.timeout !== "undefined") {
|
|
20304
20327
|
this.timeout(options.timeout === false ? 0 : options.timeout);
|
|
20305
20328
|
}
|
|
20306
20329
|
|
|
20307
|
-
if (
|
|
20330
|
+
if ("retries" in options) {
|
|
20308
20331
|
this.retries(options.retries);
|
|
20309
20332
|
}
|
|
20310
20333
|
|
|
20311
20334
|
[
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20335
|
+
"allowUncaught",
|
|
20336
|
+
"asyncOnly",
|
|
20337
|
+
"bail",
|
|
20338
|
+
"checkLeaks",
|
|
20339
|
+
"color",
|
|
20340
|
+
"delay",
|
|
20341
|
+
"diff",
|
|
20342
|
+
"dryRun",
|
|
20343
|
+
"passOnFailingTestSuite",
|
|
20344
|
+
"failZero",
|
|
20345
|
+
"forbidOnly",
|
|
20346
|
+
"forbidPending",
|
|
20347
|
+
"fullTrace",
|
|
20348
|
+
"inlineDiffs",
|
|
20349
|
+
"invert",
|
|
20327
20350
|
].forEach(function (opt) {
|
|
20328
20351
|
if (options[opt]) {
|
|
20329
20352
|
this[opt]();
|
|
@@ -20366,9 +20389,9 @@
|
|
|
20366
20389
|
|
|
20367
20390
|
if (
|
|
20368
20391
|
options.parallel &&
|
|
20369
|
-
(typeof options.jobs ===
|
|
20392
|
+
(typeof options.jobs === "undefined" || options.jobs > 1)
|
|
20370
20393
|
) {
|
|
20371
|
-
debug(
|
|
20394
|
+
debug("attempting to enable parallel mode");
|
|
20372
20395
|
this.parallelMode(true);
|
|
20373
20396
|
}
|
|
20374
20397
|
}
|
|
@@ -20422,10 +20445,10 @@
|
|
|
20422
20445
|
* mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
|
|
20423
20446
|
*/
|
|
20424
20447
|
Mocha.prototype.reporter = function (reporterName, reporterOptions) {
|
|
20425
|
-
if (typeof reporterName ===
|
|
20448
|
+
if (typeof reporterName === "function") {
|
|
20426
20449
|
this._reporter = reporterName;
|
|
20427
20450
|
} else {
|
|
20428
|
-
reporterName = reporterName ||
|
|
20451
|
+
reporterName = reporterName || "spec";
|
|
20429
20452
|
var reporter;
|
|
20430
20453
|
// Try to load a built-in reporter.
|
|
20431
20454
|
if (builtinReporters[reporterName]) {
|
|
@@ -20470,10 +20493,10 @@
|
|
|
20470
20493
|
*/
|
|
20471
20494
|
Mocha.prototype.ui = function (ui) {
|
|
20472
20495
|
var bindInterface;
|
|
20473
|
-
if (typeof ui ===
|
|
20496
|
+
if (typeof ui === "function") {
|
|
20474
20497
|
bindInterface = ui;
|
|
20475
20498
|
} else {
|
|
20476
|
-
ui = ui ||
|
|
20499
|
+
ui = ui || "bdd";
|
|
20477
20500
|
bindInterface = exports.interfaces[ui];
|
|
20478
20501
|
if (!bindInterface) {
|
|
20479
20502
|
try {
|
|
@@ -20541,7 +20564,7 @@
|
|
|
20541
20564
|
* .then(() => mocha.run(failures => process.exitCode = failures ? 1 : 0))
|
|
20542
20565
|
* .catch(() => process.exitCode = 1);
|
|
20543
20566
|
*/
|
|
20544
|
-
Mocha.prototype.loadFilesAsync = function ({esmDecorator} = {}) {
|
|
20567
|
+
Mocha.prototype.loadFilesAsync = function ({ esmDecorator } = {}) {
|
|
20545
20568
|
var self = this;
|
|
20546
20569
|
var suite = this.suite;
|
|
20547
20570
|
this.lazyLoadFiles(true);
|
|
@@ -20555,7 +20578,7 @@
|
|
|
20555
20578
|
suite.emit(EVENT_FILE_REQUIRE, resultModule, file, self);
|
|
20556
20579
|
suite.emit(EVENT_FILE_POST_REQUIRE, commonjsGlobal, file, self);
|
|
20557
20580
|
},
|
|
20558
|
-
esmDecorator
|
|
20581
|
+
esmDecorator,
|
|
20559
20582
|
);
|
|
20560
20583
|
};
|
|
20561
20584
|
|
|
@@ -20570,7 +20593,7 @@
|
|
|
20570
20593
|
Mocha.unloadFile = function (file) {
|
|
20571
20594
|
if (utils.isBrowser()) {
|
|
20572
20595
|
throw createUnsupportedError(
|
|
20573
|
-
|
|
20596
|
+
"unloadFile() is only supported in a Node.js environment",
|
|
20574
20597
|
);
|
|
20575
20598
|
}
|
|
20576
20599
|
return require$$18.unloadFile(file);
|
|
@@ -20594,9 +20617,9 @@
|
|
|
20594
20617
|
Mocha.prototype.unloadFiles = function () {
|
|
20595
20618
|
if (this._state === mochaStates.DISPOSED) {
|
|
20596
20619
|
throw createMochaInstanceAlreadyDisposedError(
|
|
20597
|
-
|
|
20620
|
+
"Mocha instance is already disposed, it cannot be used again.",
|
|
20598
20621
|
this._cleanReferencesAfterRun,
|
|
20599
|
-
this
|
|
20622
|
+
this,
|
|
20600
20623
|
);
|
|
20601
20624
|
}
|
|
20602
20625
|
|
|
@@ -20726,7 +20749,7 @@
|
|
|
20726
20749
|
Mocha.prototype.dispose = function () {
|
|
20727
20750
|
if (this._state === mochaStates.RUNNING) {
|
|
20728
20751
|
throw createMochaInstanceAlreadyRunningError(
|
|
20729
|
-
|
|
20752
|
+
"Cannot dispose while the mocha instance is still running tests.",
|
|
20730
20753
|
);
|
|
20731
20754
|
}
|
|
20732
20755
|
this.unloadFiles();
|
|
@@ -20981,7 +21004,7 @@
|
|
|
20981
21004
|
* @return {Mocha} this
|
|
20982
21005
|
* @chainable
|
|
20983
21006
|
*/
|
|
20984
|
-
Mocha.prototype.passOnFailingTestSuite = function(passOnFailingTestSuite) {
|
|
21007
|
+
Mocha.prototype.passOnFailingTestSuite = function (passOnFailingTestSuite) {
|
|
20985
21008
|
this.options.passOnFailingTestSuite = passOnFailingTestSuite === true;
|
|
20986
21009
|
return this;
|
|
20987
21010
|
};
|
|
@@ -21021,8 +21044,8 @@
|
|
|
21021
21044
|
Mocha.prototype._guardRunningStateTransition = function () {
|
|
21022
21045
|
if (this._state === mochaStates.RUNNING) {
|
|
21023
21046
|
throw createMochaInstanceAlreadyRunningError(
|
|
21024
|
-
|
|
21025
|
-
this
|
|
21047
|
+
"Mocha instance is currently running tests, cannot start a next test run until this one is done",
|
|
21048
|
+
this,
|
|
21026
21049
|
);
|
|
21027
21050
|
}
|
|
21028
21051
|
if (
|
|
@@ -21030,9 +21053,9 @@
|
|
|
21030
21053
|
this._state === mochaStates.REFERENCES_CLEANED
|
|
21031
21054
|
) {
|
|
21032
21055
|
throw createMochaInstanceAlreadyDisposedError(
|
|
21033
|
-
|
|
21056
|
+
"Mocha instance is already disposed, cannot start a new test run. Please create a new mocha instance. Be sure to set disable `cleanReferencesAfterRun` when you want to reuse the same mocha instance for multiple test runs.",
|
|
21034
21057
|
this._cleanReferencesAfterRun,
|
|
21035
|
-
this
|
|
21058
|
+
this,
|
|
21036
21059
|
);
|
|
21037
21060
|
}
|
|
21038
21061
|
};
|
|
@@ -21044,11 +21067,11 @@
|
|
|
21044
21067
|
* @type string
|
|
21045
21068
|
* @readonly
|
|
21046
21069
|
*/
|
|
21047
|
-
Object.defineProperty(Mocha.prototype,
|
|
21070
|
+
Object.defineProperty(Mocha.prototype, "version", {
|
|
21048
21071
|
value: require$$17.version,
|
|
21049
21072
|
configurable: false,
|
|
21050
21073
|
enumerable: true,
|
|
21051
|
-
writable: false
|
|
21074
|
+
writable: false,
|
|
21052
21075
|
});
|
|
21053
21076
|
|
|
21054
21077
|
/**
|
|
@@ -21086,7 +21109,7 @@
|
|
|
21086
21109
|
cleanReferencesAfterRun: this._cleanReferencesAfterRun,
|
|
21087
21110
|
delay: options.delay,
|
|
21088
21111
|
dryRun: options.dryRun,
|
|
21089
|
-
failZero: options.failZero
|
|
21112
|
+
failZero: options.failZero,
|
|
21090
21113
|
});
|
|
21091
21114
|
createStatsCollector(runner);
|
|
21092
21115
|
var reporter = new this._reporter(runner, options);
|
|
@@ -21108,30 +21131,30 @@
|
|
|
21108
21131
|
exports.reporters.Base.inlineDiffs = options.inlineDiffs;
|
|
21109
21132
|
exports.reporters.Base.hideDiff = !options.diff;
|
|
21110
21133
|
|
|
21111
|
-
const done = failures => {
|
|
21134
|
+
const done = (failures) => {
|
|
21112
21135
|
this._previousRunner = runner;
|
|
21113
21136
|
this._state = this._cleanReferencesAfterRun
|
|
21114
21137
|
? mochaStates.REFERENCES_CLEANED
|
|
21115
21138
|
: mochaStates.INIT;
|
|
21116
21139
|
fn = fn || utils.noop;
|
|
21117
|
-
if (typeof reporter.done ===
|
|
21140
|
+
if (typeof reporter.done === "function") {
|
|
21118
21141
|
reporter.done(failures, fn);
|
|
21119
21142
|
} else {
|
|
21120
21143
|
fn(failures);
|
|
21121
21144
|
}
|
|
21122
21145
|
};
|
|
21123
21146
|
|
|
21124
|
-
const runAsync = async runner => {
|
|
21147
|
+
const runAsync = async (runner) => {
|
|
21125
21148
|
const context =
|
|
21126
21149
|
this.options.enableGlobalSetup && this.hasGlobalSetupFixtures()
|
|
21127
21150
|
? await this.runGlobalSetup(runner)
|
|
21128
21151
|
: {};
|
|
21129
21152
|
const failureCount = await runner.runAsync({
|
|
21130
21153
|
files: this.files,
|
|
21131
|
-
options
|
|
21154
|
+
options,
|
|
21132
21155
|
});
|
|
21133
21156
|
if (this.options.enableGlobalTeardown && this.hasGlobalTeardownFixtures()) {
|
|
21134
|
-
await this.runGlobalTeardown(runner, {context});
|
|
21157
|
+
await this.runGlobalTeardown(runner, { context });
|
|
21135
21158
|
}
|
|
21136
21159
|
return failureCount;
|
|
21137
21160
|
};
|
|
@@ -21155,22 +21178,22 @@
|
|
|
21155
21178
|
beforeAll = [],
|
|
21156
21179
|
beforeEach = [],
|
|
21157
21180
|
afterAll = [],
|
|
21158
|
-
afterEach = []
|
|
21181
|
+
afterEach = [],
|
|
21159
21182
|
} = {}) {
|
|
21160
21183
|
beforeAll = utils.castArray(beforeAll);
|
|
21161
21184
|
beforeEach = utils.castArray(beforeEach);
|
|
21162
21185
|
afterAll = utils.castArray(afterAll);
|
|
21163
21186
|
afterEach = utils.castArray(afterEach);
|
|
21164
|
-
beforeAll.forEach(hook => {
|
|
21187
|
+
beforeAll.forEach((hook) => {
|
|
21165
21188
|
this.suite.beforeAll(hook);
|
|
21166
21189
|
});
|
|
21167
|
-
beforeEach.forEach(hook => {
|
|
21190
|
+
beforeEach.forEach((hook) => {
|
|
21168
21191
|
this.suite.beforeEach(hook);
|
|
21169
21192
|
});
|
|
21170
|
-
afterAll.forEach(hook => {
|
|
21193
|
+
afterAll.forEach((hook) => {
|
|
21171
21194
|
this.suite.afterAll(hook);
|
|
21172
21195
|
});
|
|
21173
|
-
afterEach.forEach(hook => {
|
|
21196
|
+
afterEach.forEach((hook) => {
|
|
21174
21197
|
this.suite.afterEach(hook);
|
|
21175
21198
|
});
|
|
21176
21199
|
return this;
|
|
@@ -21193,7 +21216,7 @@
|
|
|
21193
21216
|
*/
|
|
21194
21217
|
Mocha.prototype.parallelMode = function parallelMode(enable = true) {
|
|
21195
21218
|
if (utils.isBrowser()) {
|
|
21196
|
-
throw createUnsupportedError(
|
|
21219
|
+
throw createUnsupportedError("parallel mode is only supported in Node.js");
|
|
21197
21220
|
}
|
|
21198
21221
|
const parallel = Boolean(enable);
|
|
21199
21222
|
if (
|
|
@@ -21205,7 +21228,7 @@
|
|
|
21205
21228
|
}
|
|
21206
21229
|
if (this._state !== mochaStates.INIT) {
|
|
21207
21230
|
throw createUnsupportedError(
|
|
21208
|
-
|
|
21231
|
+
"cannot change parallel mode after having called run()",
|
|
21209
21232
|
);
|
|
21210
21233
|
}
|
|
21211
21234
|
this.options.parallel = parallel;
|
|
@@ -21232,7 +21255,7 @@
|
|
|
21232
21255
|
*/
|
|
21233
21256
|
Mocha.prototype.lazyLoadFiles = function lazyLoadFiles(enable) {
|
|
21234
21257
|
this._lazyLoadFiles = enable === true;
|
|
21235
|
-
debug(
|
|
21258
|
+
debug("set lazy load to %s", enable);
|
|
21236
21259
|
return this;
|
|
21237
21260
|
};
|
|
21238
21261
|
|
|
@@ -21248,7 +21271,7 @@
|
|
|
21248
21271
|
Mocha.prototype.globalSetup = function globalSetup(setupFns = []) {
|
|
21249
21272
|
setupFns = utils.castArray(setupFns);
|
|
21250
21273
|
this.options.globalSetup = setupFns;
|
|
21251
|
-
debug(
|
|
21274
|
+
debug("configured %d global setup functions", setupFns.length);
|
|
21252
21275
|
return this;
|
|
21253
21276
|
};
|
|
21254
21277
|
|
|
@@ -21264,7 +21287,7 @@
|
|
|
21264
21287
|
Mocha.prototype.globalTeardown = function globalTeardown(teardownFns = []) {
|
|
21265
21288
|
teardownFns = utils.castArray(teardownFns);
|
|
21266
21289
|
this.options.globalTeardown = teardownFns;
|
|
21267
|
-
debug(
|
|
21290
|
+
debug("configured %d global teardown functions", teardownFns.length);
|
|
21268
21291
|
return this;
|
|
21269
21292
|
};
|
|
21270
21293
|
|
|
@@ -21279,11 +21302,11 @@
|
|
|
21279
21302
|
* @returns {Promise<object>} Context object
|
|
21280
21303
|
*/
|
|
21281
21304
|
Mocha.prototype.runGlobalSetup = async function runGlobalSetup(context = {}) {
|
|
21282
|
-
const {globalSetup} = this.options;
|
|
21305
|
+
const { globalSetup } = this.options;
|
|
21283
21306
|
if (globalSetup && globalSetup.length) {
|
|
21284
|
-
debug(
|
|
21307
|
+
debug("run(): global setup starting");
|
|
21285
21308
|
await this._runGlobalFixtures(globalSetup, context);
|
|
21286
|
-
debug(
|
|
21309
|
+
debug("run(): global setup complete");
|
|
21287
21310
|
}
|
|
21288
21311
|
return context;
|
|
21289
21312
|
};
|
|
@@ -21299,14 +21322,14 @@
|
|
|
21299
21322
|
* @returns {Promise<object>} Context object
|
|
21300
21323
|
*/
|
|
21301
21324
|
Mocha.prototype.runGlobalTeardown = async function runGlobalTeardown(
|
|
21302
|
-
context = {}
|
|
21325
|
+
context = {},
|
|
21303
21326
|
) {
|
|
21304
|
-
const {globalTeardown} = this.options;
|
|
21327
|
+
const { globalTeardown } = this.options;
|
|
21305
21328
|
if (globalTeardown && globalTeardown.length) {
|
|
21306
|
-
debug(
|
|
21329
|
+
debug("run(): global teardown starting");
|
|
21307
21330
|
await this._runGlobalFixtures(globalTeardown, context);
|
|
21308
21331
|
}
|
|
21309
|
-
debug(
|
|
21332
|
+
debug("run(): global teardown complete");
|
|
21310
21333
|
return context;
|
|
21311
21334
|
};
|
|
21312
21335
|
|
|
@@ -21319,7 +21342,7 @@
|
|
|
21319
21342
|
*/
|
|
21320
21343
|
Mocha.prototype._runGlobalFixtures = async function _runGlobalFixtures(
|
|
21321
21344
|
fixtureFns = [],
|
|
21322
|
-
context = {}
|
|
21345
|
+
context = {},
|
|
21323
21346
|
) {
|
|
21324
21347
|
for await (const fixtureFn of fixtureFns) {
|
|
21325
21348
|
await fixtureFn.call(context);
|
|
@@ -21349,7 +21372,7 @@
|
|
|
21349
21372
|
* @returns {Mocha}
|
|
21350
21373
|
*/
|
|
21351
21374
|
Mocha.prototype.enableGlobalTeardown = function enableGlobalTeardown(
|
|
21352
|
-
enabled = true
|
|
21375
|
+
enabled = true,
|
|
21353
21376
|
) {
|
|
21354
21377
|
this.options.enableGlobalTeardown = Boolean(enabled);
|
|
21355
21378
|
return this;
|
|
@@ -21382,7 +21405,7 @@
|
|
|
21382
21405
|
* Shim process.stdout.
|
|
21383
21406
|
*/
|
|
21384
21407
|
|
|
21385
|
-
process.stdout = browserStdout({label: false});
|
|
21408
|
+
process.stdout = browserStdout({ label: false });
|
|
21386
21409
|
|
|
21387
21410
|
var parseQuery = parseQuery$1;
|
|
21388
21411
|
var highlightTags = highlightTags$1;
|
|
@@ -21394,7 +21417,7 @@
|
|
|
21394
21417
|
* @return {undefined}
|
|
21395
21418
|
*/
|
|
21396
21419
|
|
|
21397
|
-
var mocha = new Mocha({reporter:
|
|
21420
|
+
var mocha = new Mocha({ reporter: "html" });
|
|
21398
21421
|
|
|
21399
21422
|
/**
|
|
21400
21423
|
* Save timer references to avoid Sinon interfering (see GH-237).
|
|
@@ -21416,7 +21439,7 @@
|
|
|
21416
21439
|
*/
|
|
21417
21440
|
|
|
21418
21441
|
process.removeListener = function (e, fn) {
|
|
21419
|
-
if (e ===
|
|
21442
|
+
if (e === "uncaughtException") {
|
|
21420
21443
|
if (originalOnerrorHandler) {
|
|
21421
21444
|
commonjsGlobal.onerror = originalOnerrorHandler;
|
|
21422
21445
|
} else {
|
|
@@ -21434,7 +21457,7 @@
|
|
|
21434
21457
|
*/
|
|
21435
21458
|
|
|
21436
21459
|
process.listenerCount = function (name) {
|
|
21437
|
-
if (name ===
|
|
21460
|
+
if (name === "uncaughtException") {
|
|
21438
21461
|
return uncaughtExceptionHandlers.length;
|
|
21439
21462
|
}
|
|
21440
21463
|
return 0;
|
|
@@ -21445,9 +21468,9 @@
|
|
|
21445
21468
|
*/
|
|
21446
21469
|
|
|
21447
21470
|
process.on = function (e, fn) {
|
|
21448
|
-
if (e ===
|
|
21471
|
+
if (e === "uncaughtException") {
|
|
21449
21472
|
commonjsGlobal.onerror = function (msg, url, line, col, err) {
|
|
21450
|
-
fn(err || new Error(msg +
|
|
21473
|
+
fn(err || new Error(msg + " (" + url + ":" + line + ":" + col + ")"));
|
|
21451
21474
|
return !mocha.options.allowUncaught;
|
|
21452
21475
|
};
|
|
21453
21476
|
uncaughtExceptionHandlers.push(fn);
|
|
@@ -21455,7 +21478,7 @@
|
|
|
21455
21478
|
};
|
|
21456
21479
|
|
|
21457
21480
|
process.listeners = function (err) {
|
|
21458
|
-
if (err ===
|
|
21481
|
+
if (err === "uncaughtException") {
|
|
21459
21482
|
return uncaughtExceptionHandlers;
|
|
21460
21483
|
}
|
|
21461
21484
|
return [];
|
|
@@ -21464,7 +21487,7 @@
|
|
|
21464
21487
|
// The BDD UI is registered by default, but no UI will be functional in the
|
|
21465
21488
|
// browser without an explicit call to the overridden `mocha.ui` (see below).
|
|
21466
21489
|
// Ensure that this default UI does not expose its methods to the global scope.
|
|
21467
|
-
mocha.suite.removeAllListeners(
|
|
21490
|
+
mocha.suite.removeAllListeners("pre-require");
|
|
21468
21491
|
|
|
21469
21492
|
var immediateQueue = [];
|
|
21470
21493
|
var immediateTimeout;
|
|
@@ -21511,7 +21534,7 @@
|
|
|
21511
21534
|
|
|
21512
21535
|
mocha.ui = function (ui) {
|
|
21513
21536
|
Mocha.prototype.ui.call(this, ui);
|
|
21514
|
-
this.suite.emit(
|
|
21537
|
+
this.suite.emit("pre-require", commonjsGlobal, null, this);
|
|
21515
21538
|
return this;
|
|
21516
21539
|
};
|
|
21517
21540
|
|
|
@@ -21520,8 +21543,8 @@
|
|
|
21520
21543
|
*/
|
|
21521
21544
|
|
|
21522
21545
|
mocha.setup = function (opts) {
|
|
21523
|
-
if (typeof opts ===
|
|
21524
|
-
opts = {ui: opts};
|
|
21546
|
+
if (typeof opts === "string") {
|
|
21547
|
+
opts = { ui: opts };
|
|
21525
21548
|
}
|
|
21526
21549
|
if (opts.delay === true) {
|
|
21527
21550
|
this.delay();
|
|
@@ -21529,7 +21552,7 @@
|
|
|
21529
21552
|
var self = this;
|
|
21530
21553
|
Object.keys(opts)
|
|
21531
21554
|
.filter(function (opt) {
|
|
21532
|
-
return opt !==
|
|
21555
|
+
return opt !== "delay";
|
|
21533
21556
|
})
|
|
21534
21557
|
.forEach(function (opt) {
|
|
21535
21558
|
if (Object.prototype.hasOwnProperty.call(opts, opt)) {
|
|
@@ -21545,9 +21568,9 @@
|
|
|
21545
21568
|
|
|
21546
21569
|
mocha.run = function (fn) {
|
|
21547
21570
|
var options = mocha.options;
|
|
21548
|
-
mocha.globals(
|
|
21571
|
+
mocha.globals("location");
|
|
21549
21572
|
|
|
21550
|
-
var query = parseQuery(commonjsGlobal.location.search ||
|
|
21573
|
+
var query = parseQuery(commonjsGlobal.location.search || "");
|
|
21551
21574
|
if (query.grep) {
|
|
21552
21575
|
mocha.grep(query.grep);
|
|
21553
21576
|
}
|
|
@@ -21563,10 +21586,10 @@
|
|
|
21563
21586
|
var document = commonjsGlobal.document;
|
|
21564
21587
|
if (
|
|
21565
21588
|
document &&
|
|
21566
|
-
document.getElementById(
|
|
21589
|
+
document.getElementById("mocha") &&
|
|
21567
21590
|
options.noHighlighting !== true
|
|
21568
21591
|
) {
|
|
21569
|
-
highlightTags(
|
|
21592
|
+
highlightTags("code");
|
|
21570
21593
|
}
|
|
21571
21594
|
if (fn) {
|
|
21572
21595
|
fn(err);
|