mocha 12.0.0-beta-2 → 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 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
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  /* eslint no-unused-vars: off */
4
- /* eslint-env commonjs */
5
4
 
6
5
  /**
7
6
  * Shim process.stdout.
package/lib/cli/config.js CHANGED
@@ -52,7 +52,7 @@ const parsers = (exports.parsers = {
52
52
  },
53
53
  json: (filepath) =>
54
54
  JSON.parse(
55
- require("strip-json-comments")(fs.readFileSync(filepath, "utf8")),
55
+ require("strip-json-comments").default(fs.readFileSync(filepath, "utf8")),
56
56
  ),
57
57
  });
58
58
 
@@ -112,7 +112,7 @@ module.exports = function lookupFiles(
112
112
  if (stat.isFile() || stat.isFIFO()) {
113
113
  return filepath;
114
114
  }
115
- } catch (err) {
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 (ignored) {
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 (ignored) {
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 (err) {
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) {
@@ -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) {
@@ -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 (err) {
87
+ } catch {
89
88
  throw createInvalidArgumentValueError(
90
89
  "run() was unable to deserialize the options",
91
90
  "serializedOptions",
@@ -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 (err) {
220
+ } catch {
221
221
  var msg =
222
222
  "\n " +
223
223
  color("diff added", "+ expected") +
@@ -4,7 +4,6 @@
4
4
  * @typedef {import('../runner.js')} Runner
5
5
  */
6
6
 
7
- /* eslint-env browser */
8
7
  /**
9
8
  * @module HTML
10
9
  */
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 (ignore) {
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
- /* eslint-disable no-unused-vars */
365
+
366
366
  var prop;
367
- /* eslint-enable no-unused-vars */
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, no-unreachable-loop */
395
+ /* eslint-disable-next-line no-unused-vars */
396
396
  for (prop in value) {
397
397
  canonicalizedObj = {};
398
398
  break;
399
399
  }
400
- /* eslint-enable guard-for-in */
400
+
401
401
  if (!canonicalizedObj) {
402
402
  canonicalizedObj = emptyRepresentation(value, typeHint);
403
403
  break;