mocha 12.0.0-beta-5 → 12.0.0-beta-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.
@@ -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
 
package/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@12.0.0-beta-5 in javascript ES2018
1
+ // mocha@12.0.0-beta-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) :
@@ -11340,6 +11340,16 @@
11340
11340
 
11341
11341
  debug("timeout %d", ms);
11342
11342
  this._timeout = parseInt(ms, 10);
11343
+
11344
+ // Allow overriding inner/nested suites
11345
+ // See and test-cases with chain-called timeout argument.
11346
+ // https://github.com/mochajs/mocha/issues/5422
11347
+ for (const t of this.tests) {
11348
+ t.timeout(this._timeout);
11349
+ }
11350
+ for (const s of this.suites) {
11351
+ s.timeout(this._timeout);
11352
+ }
11343
11353
  return this;
11344
11354
  };
11345
11355