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
Copy file name to clipboardExpand all lines: docs/index.md
+3-10
Original file line number
Diff line number
Diff line change
@@ -1065,7 +1065,6 @@ Require a module before loading the user interface or test files. This is useful
1065
1065
1066
1066
- Test harnesses
1067
1067
- Assertion libraries that augment built-ins or global scope (such as [should.js][npm-should.js])
1068
-
- Instant ECMAScript modules via [esm][npm-esm]
1069
1068
- Compilers such as Babel via [@babel/register][npm-babel-register] or TypeScript via [ts-node][npm-ts-node] (using `--require ts-node/register`). See [Babel][example-babel] or [TypeScript][example-typescript] working examples.
1070
1069
1071
1070
Modules required in this manner are expected to do work synchronously; Mocha won't wait for async tasks in a required module to finish.
@@ -2034,20 +2033,15 @@ this means either ending the file with a `.mjs` extension, or, if you want to us
2034
2033
adding `"type": "module"` to your `package.json`.
2035
2034
More information can be found in the [Node.js documentation](https://nodejs.org/api/esm.html).
2036
2035
2037
-
> Mocha supports ES modules only from Node.js v12.11.0 and above. To enable this in versions smaller than 13.2.0, you need to add `--experimental-modules` when running
2038
-
> Mocha. From version 13.2.0 of Node.js, you can use ES modules without any flags.
2039
-
> (Mocha _will_ load ESM even in Node v10, but this is not officially supported. Use at your own risk.)
2040
-
2041
2036
### Current Limitations
2042
2037
2043
-
Node.JS native ESM support still has status: **Stability: 1 - Experimental**
2044
-
2045
2038
-[Watch mode](#-watch-w) does not support ES Module test files
2046
2039
-[Custom reporters](#third-party-reporters) and [custom interfaces](#interfaces)
2047
2040
can only be CommonJS files
2048
2041
-[Configuration file](#configuring-mocha-nodejs) can only be a CommonJS file (`.mocharc.js` or `.mocharc.cjs`)
2049
-
- When using module-level mocks via libs like `proxyquire`, `rewiremock` or `rewire`, hold off on using ES modules for your test files
2050
-
- Node.JS native ESM support does not work with [esm][npm-esm] module
2042
+
- When using module-level mocks via libs like `proxyquire`, `rewiremock` or `rewire`,
2043
+
hold off on using ES modules for your test files. You can switch to using `testdouble`,
2044
+
which does support ESM.
2051
2045
2052
2046
## Running Mocha in the Browser
2053
2047
@@ -2426,7 +2420,6 @@ or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js).
0 commit comments