Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

docs: clarify supported mocha version for ESM configuration (#6027)

Owen Buckley5921837be8d5
diff --git a/docs/src/content/docs/running/configuring.mdx b/docs/src/content/docs/running/configuring.mdx
index 54739352..61f9c457 100644
--- a/docs/src/content/docs/running/configuring.mdx
+++ b/docs/src/content/docs/running/configuring.mdx
@@ -3,14 +3,18 @@ description: Configuration options and files across several formats.
title: Configuring Mocha (Node.js)
---
+:::note[New in v12.0.0]
+:::
+
+Mocha added support for ESM configuration files (`export default {/* ... */}`) when using [`"type"="module"`](#nodejs-native-esm-support) in your `package.json`
+or the `.mjs` file extension.
+
:::note[New in v6.0.0]
:::
Mocha supports configuration files, typical of modern command-line tools, in several formats:
-- **JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](/explainers/nodejs-native-esm-support) in your `package.json`)
- in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
- or using `.mjs`, use a default export (`export default {/* ... */}`).
+- **JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](#nodejs-native-esm-support) in your `package.json`)
- **YAML**: Create a `.mocharc.yaml` (or `.mocharc.yml`) in your project's root directory.
- **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.