mocha 12.0.0-beta-1 → 12.0.0-beta-3
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/README.md +1 -1
- package/browser-entry.js +0 -1
- package/lib/cli/config.js +1 -1
- package/lib/cli/lookup-files.js +2 -2
- package/lib/errors.js +1 -1
- package/lib/mocha.js +9 -1
- package/lib/nodejs/esm-utils.js +3 -0
- package/lib/nodejs/worker.js +1 -2
- package/lib/reporters/base.js +1 -1
- package/lib/reporters/html.js +0 -1
- package/lib/runner.js +2 -2
- package/lib/utils.js +4 -4
- package/mocha.js +20182 -21635
- package/mocha.js.map +1 -1
- package/mocha.mjs +68 -0
- package/package.json +21 -23
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
[Become a backer](https://opencollective.com/mochajs) and show your support to our open source project on [our site](https://mochajs.org/#backers).
|
|
38
38
|
|
|
39
|
-
<a href="https://opencollective.com/mochajs"><img src="https://opencollective.com/mochajs/tiers/backers.svg?limit=30&button=false&avatarHeight=46&width=750"></a>
|
|
39
|
+
<a href="https://opencollective.com/mochajs"><img alt="Mocha's backers on Open Collective" src="https://opencollective.com/mochajs/tiers/backers.svg?limit=30&button=false&avatarHeight=46&width=750"></a>
|
|
40
40
|
|
|
41
41
|
## Sponsors
|
|
42
42
|
|
package/browser-entry.js
CHANGED
package/lib/cli/config.js
CHANGED
package/lib/cli/lookup-files.js
CHANGED
|
@@ -112,7 +112,7 @@ module.exports = function lookupFiles(
|
|
|
112
112
|
if (stat.isFile() || stat.isFIFO()) {
|
|
113
113
|
return filepath;
|
|
114
114
|
}
|
|
115
|
-
} catch
|
|
115
|
+
} catch {
|
|
116
116
|
// ignore error
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
@@ -130,7 +130,7 @@ module.exports = function lookupFiles(
|
|
|
130
130
|
}
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
} catch
|
|
133
|
+
} catch {
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
if (!extensions.length) {
|
package/lib/errors.js
CHANGED
|
@@ -299,7 +299,7 @@ function createMultipleDoneError(runnable, originalErr) {
|
|
|
299
299
|
if (runnable.parent.root) {
|
|
300
300
|
title += " (of root suite)";
|
|
301
301
|
}
|
|
302
|
-
} catch
|
|
302
|
+
} catch {
|
|
303
303
|
title = format("<%s> (of unknown suite)", runnable.title);
|
|
304
304
|
}
|
|
305
305
|
var message = format(
|
package/lib/mocha.js
CHANGED
|
@@ -329,6 +329,10 @@ Mocha.prototype.reporter = function (reporterName, reporterOptions) {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
+
if (reporter.default) {
|
|
333
|
+
reporter = reporter.default;
|
|
334
|
+
}
|
|
335
|
+
|
|
332
336
|
this._reporter = reporter;
|
|
333
337
|
}
|
|
334
338
|
this.options.reporterOption = reporterOptions;
|
|
@@ -358,11 +362,15 @@ Mocha.prototype.ui = function (ui) {
|
|
|
358
362
|
if (!bindInterface) {
|
|
359
363
|
try {
|
|
360
364
|
bindInterface = require(ui);
|
|
361
|
-
} catch
|
|
365
|
+
} catch {
|
|
362
366
|
throw createInvalidInterfaceError(`invalid interface '${ui}'`, ui);
|
|
363
367
|
}
|
|
364
368
|
}
|
|
365
369
|
}
|
|
370
|
+
if (bindInterface.default) {
|
|
371
|
+
bindInterface = bindInterface.default;
|
|
372
|
+
}
|
|
373
|
+
|
|
366
374
|
bindInterface(this.suite);
|
|
367
375
|
|
|
368
376
|
this.suite.on(EVENT_FILE_PRE_REQUIRE, function (context) {
|
package/lib/nodejs/esm-utils.js
CHANGED
|
@@ -98,6 +98,9 @@ const requireModule = async (file, esmDecorator) => {
|
|
|
98
98
|
return require(file);
|
|
99
99
|
} catch (requireErr) {
|
|
100
100
|
debug("requireModule caught err: %O", requireErr.message);
|
|
101
|
+
if (requireErr.name === 'TSError') {
|
|
102
|
+
throw requireErr;
|
|
103
|
+
}
|
|
101
104
|
try {
|
|
102
105
|
return dealWithExports(await formattedImport(file, esmDecorator));
|
|
103
106
|
} catch (importErr) {
|
package/lib/nodejs/worker.js
CHANGED
|
@@ -83,9 +83,8 @@ async function run(filepath, serializedOptions = "{}") {
|
|
|
83
83
|
}
|
|
84
84
|
let argv;
|
|
85
85
|
try {
|
|
86
|
-
// eslint-disable-next-line no-eval
|
|
87
86
|
argv = eval("(" + serializedOptions + ")");
|
|
88
|
-
} catch
|
|
87
|
+
} catch {
|
|
89
88
|
throw createInvalidArgumentValueError(
|
|
90
89
|
"run() was unable to deserialize the options",
|
|
91
90
|
"serializedOptions",
|
package/lib/reporters/base.js
CHANGED
|
@@ -217,7 +217,7 @@ var generateDiff = (exports.generateDiff = function (actual, expected) {
|
|
|
217
217
|
result = `${result}\n [mocha] output truncated to ${maxLen} characters, see "maxDiffSize" reporter-option\n`;
|
|
218
218
|
}
|
|
219
219
|
return result;
|
|
220
|
-
} catch
|
|
220
|
+
} catch {
|
|
221
221
|
var msg =
|
|
222
222
|
"\n " +
|
|
223
223
|
color("diff added", "+ expected") +
|
package/lib/reporters/html.js
CHANGED
package/lib/runner.js
CHANGED
|
@@ -495,8 +495,8 @@ Runner.prototype.fail = function (test, err, force) {
|
|
|
495
495
|
|
|
496
496
|
try {
|
|
497
497
|
currentErr.stack = stackFilter(currentErr.stack);
|
|
498
|
-
} catch
|
|
499
|
-
// some environments do not take kindly to monkeying with the stack
|
|
498
|
+
} catch {
|
|
499
|
+
// Ignore error as some environments do not take kindly to monkeying with the stack
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
currentErr = currentErr.cause;
|
package/lib/utils.js
CHANGED
|
@@ -362,9 +362,9 @@ function jsonStringify(object, spaces, depth) {
|
|
|
362
362
|
*/
|
|
363
363
|
exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
|
364
364
|
var canonicalizedObj;
|
|
365
|
-
|
|
365
|
+
|
|
366
366
|
var prop;
|
|
367
|
-
|
|
367
|
+
|
|
368
368
|
typeHint = typeHint || canonicalType(value);
|
|
369
369
|
function withStack(value, fn) {
|
|
370
370
|
stack.push(value);
|
|
@@ -392,12 +392,12 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) {
|
|
|
392
392
|
});
|
|
393
393
|
break;
|
|
394
394
|
case "function":
|
|
395
|
-
/* eslint-disable-next-line no-unused-vars
|
|
395
|
+
/* eslint-disable-next-line no-unused-vars */
|
|
396
396
|
for (prop in value) {
|
|
397
397
|
canonicalizedObj = {};
|
|
398
398
|
break;
|
|
399
399
|
}
|
|
400
|
-
|
|
400
|
+
|
|
401
401
|
if (!canonicalizedObj) {
|
|
402
402
|
canonicalizedObj = emptyRepresentation(value, typeHint);
|
|
403
403
|
break;
|