mocha 12.0.0-beta-3 → 12.0.0-beta-4

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/config.js CHANGED
@@ -24,6 +24,7 @@ const utils = require("../utils");
24
24
  exports.CONFIG_FILES = [
25
25
  ".mocharc.cjs",
26
26
  ".mocharc.js",
27
+ ".mocharc.mjs",
27
28
  ".mocharc.yaml",
28
29
  ".mocharc.yml",
29
30
  ".mocharc.jsonc",
@@ -72,8 +73,9 @@ exports.loadConfig = (filepath) => {
72
73
  try {
73
74
  if (ext === ".yml" || ext === ".yaml") {
74
75
  config = parsers.yaml(filepath);
75
- } else if (ext === ".js" || ext === ".cjs") {
76
- config = parsers.js(filepath);
76
+ } else if (ext === ".js" || ext === ".cjs" || ext === ".mjs") {
77
+ const parsedConfig = parsers.js(filepath);
78
+ config = parsedConfig.default ?? parsedConfig;
77
79
  } else {
78
80
  config = parsers.json(filepath);
79
81
  }
@@ -98,7 +98,7 @@ 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') {
101
+ if (requireErr.name === "TSError") {
102
102
  throw requireErr;
103
103
  }
104
104
  try {