mocha 12.0.0-beta-5 → 12.0.0-beta-7
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/lib/cli/cli.js +5 -0
- package/lib/nodejs/esm-utils.js +2 -1
- package/lib/suite.js +10 -0
- package/mocha.js +19580 -18847
- package/mocha.js.map +1 -1
- package/package.json +2 -11
package/lib/cli/cli.js
CHANGED
|
@@ -66,6 +66,11 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
|
|
|
66
66
|
debug("caught error sometime before command handler: %O", err);
|
|
67
67
|
yargs.showHelp();
|
|
68
68
|
console.error(`\n${symbols.error} ${pc.red("ERROR:")} ${msg}`);
|
|
69
|
+
if (!msg) {
|
|
70
|
+
// Log raw error and stack when an unexpected error is encountered, to
|
|
71
|
+
// make debugging easier (instead of an inactionable "ERROR: null").
|
|
72
|
+
console.error(err);
|
|
73
|
+
}
|
|
69
74
|
process.exit(1);
|
|
70
75
|
})
|
|
71
76
|
.help("help", "Show usage information & exit")
|
package/lib/nodejs/esm-utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const path = require("node:path");
|
|
2
2
|
const url = require("node:url");
|
|
3
3
|
const debug = require("debug")("mocha:esm-utils");
|
|
4
|
+
const { isMochaError } = require("../errors");
|
|
4
5
|
|
|
5
6
|
const forward = (x) => x;
|
|
6
7
|
|
|
@@ -98,7 +99,7 @@ const requireModule = async (file, esmDecorator) => {
|
|
|
98
99
|
return require(file);
|
|
99
100
|
} catch (requireErr) {
|
|
100
101
|
debug("requireModule caught err: %O", requireErr.message);
|
|
101
|
-
if (requireErr.name === "TSError") {
|
|
102
|
+
if (requireErr.name === "TSError" || isMochaError(requireErr)) {
|
|
102
103
|
throw requireErr;
|
|
103
104
|
}
|
|
104
105
|
try {
|
package/lib/suite.js
CHANGED
|
@@ -159,6 +159,16 @@ Suite.prototype.timeout = function (ms) {
|
|
|
159
159
|
|
|
160
160
|
debug("timeout %d", ms);
|
|
161
161
|
this._timeout = parseInt(ms, 10);
|
|
162
|
+
|
|
163
|
+
// Allow overriding inner/nested suites
|
|
164
|
+
// See and test-cases with chain-called timeout argument.
|
|
165
|
+
// https://github.com/mochajs/mocha/issues/5422
|
|
166
|
+
for (const t of this.tests) {
|
|
167
|
+
t.timeout(this._timeout);
|
|
168
|
+
}
|
|
169
|
+
for (const s of this.suites) {
|
|
170
|
+
s.timeout(this._timeout);
|
|
171
|
+
}
|
|
162
172
|
return this;
|
|
163
173
|
};
|
|
164
174
|
|