You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mocha supports configuration files, typical of modern command-line tools, in several formats:
10
10
11
11
-**JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](/explainers/nodejs-native-esm-support) in your `package.json`)
12
-
in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration.
12
+
in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
13
+
or using `.mjs`, use a default export (`default export {/* ... */}`).
13
14
-**YAML**: Create a `.mocharc.yaml` (or `.mocharc.yml`) in your project's root directory.
14
15
-**JSON**: Create a `.mocharc.json` (or `.mocharc.jsonc`) in your project's root directory.
15
16
Comments--while not valid JSON--are allowed in this file, and will be ignored by Mocha.
Copy file name to clipboardExpand all lines: docs/index.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2254,7 +2254,9 @@ The HTML reporter is the default reporter when running Mocha in the browser. It
2254
2254
2255
2255
Mocha supports configuration files, typical of modern command-line tools, in several formats:
2256
2256
2257
-
-**JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](#nodejs-native-esm-support) in your `package.json`)
2257
+
-**JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](/explainers/nodejs-native-esm-support) in your `package.json`)
2258
+
in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
2259
+
or using `.mjs`, use a default export (`default export {/* ... */}`).
2258
2260
in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration.
2259
2261
-**YAML**: Create a `.mocharc.yaml` (or `.mocharc.yml`) in your project's root directory.
2260
2262
-**JSON**: Create a `.mocharc.json` (or `.mocharc.jsonc`) in your project's root directory. Comments — while not valid JSON — are allowed in this file, and will be ignored by Mocha.
0 commit comments