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-next/src/content/docs/explainers/nodejs-native-esm-support.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,9 @@ More information can be found in the [Node.js documentation](https://nodejs.org/
26
26
27
27
### Current Limitations
28
28
29
-
-[Watch mode](/next/running/cli#--watch--w) does not support ES Module test files
30
-
-[Custom reporters](/next/reporters/third-party) and [custom interfaces](/next/interfaces/third-party) can only be CommonJS files
31
-
-[Configuration file](/next/running/configuring) can only be a CommonJS file (`.mocharc.js` or `.mocharc.cjs`)
29
+
-[Watch mode](/running/cli#--watch--w) does not support ES Module test files
30
+
-[Custom reporters](/reporters/third-party) and [custom interfaces](/interfaces/third-party) can only be CommonJS files
31
+
-[Configuration file](/running/configuring) can only be a CommonJS file (`.mocharc.js` or `.mocharc.cjs`)
32
32
- Mocha in Node.js version 24.4.0 or older [silently ignored top level errors in ESM files](https://github.com/mochajs/mocha/issues/5396).
33
33
If you cannot upgrade to a newer Node.js version, you can add `--no-experimental-require-module` to the `NODE_OPTIONS` environment variable.
34
34
- When using module-level mocks via libs like `proxyquire`, `rewiremock` or `rewire`, hold off on using ES modules for your test files.
Copy file name to clipboardExpand all lines: docs-next/src/content/docs/explainers/run-cycle-overview.mdx
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,35 +11,35 @@ In a browser, test files are loaded by `<script>` tags, and calling `mocha.run()
11
11
12
12
1. User (that's you) executes `mocha`
13
13
2. Loads options from config files, if present
14
-
3. Mocha processes any command-line options provided (see section on [configuration merging](/next/running/configuring#merging) for details)
14
+
3. Mocha processes any command-line options provided (see section on [configuration merging](/running/configuring#merging) for details)
15
15
4. If known flags for the `node` executable are found:
16
16
1. Mocha will spawn `node` in a child process, executing itself with these flags
17
17
2. Otherwise, Mocha does not spawn a child process
18
18
5. Mocha loads modules specified by `--require`
19
-
1. If a file loaded this way contains known Mocha-specific exports (e.g., [root hook plugins](/next/features/root-hook-plugins)), Mocha "registers" these
19
+
1. If a file loaded this way contains known Mocha-specific exports (e.g., [root hook plugins](/features/root-hook-plugins)), Mocha "registers" these
20
20
2. If not, Mocha ignores any exports of a `--require`'d module
21
21
6. Mocha validates any custom reporters or interfaces which were loaded via `--require` or otherwise
22
22
7. Mocha _discovers_ test files; when given no files or directories, it finds files with extensions `.js`, `.mjs` or `.cjs` in the `test` directory (but not its children), relative to the current working directory
23
-
8. The (default) [bdd interface](/next/interfaces/bdd) loads the test files _in no particular order_, which are given an interface-specific `global` context (this is how, e.g., `describe()` ends up as a global in a test file)
23
+
8. The (default) [bdd interface](/interfaces/bdd) loads the test files _in no particular order_, which are given an interface-specific `global` context (this is how, e.g., `describe()` ends up as a global in a test file)
24
24
1. When a test file is loaded, Mocha executes all of its suites and finds--_but does not execute_--any hooks and tests therein.
25
25
2. Top-level hooks, tests and suites are all made members of an "invisible" _root suite_; there is only _one_ root suite for the entire process
26
-
9. Mocha runs [global setup fixtures](/next/features/global-fixtures#global-setup-fixtures), if any
26
+
9. Mocha runs [global setup fixtures](/features/global-fixtures#global-setup-fixtures), if any
27
27
10. Starting with the "root" suite, Mocha executes:
28
-
11. Any "before all" hooks (for the _root_ suite, this only happens once; see [root hook plugins](/next/features/root-hook-plugins))
28
+
11. Any "before all" hooks (for the _root_ suite, this only happens once; see [root hook plugins](/features/root-hook-plugins))
29
29
12. For each test, Mocha executes:
30
30
1. Any "before each" hooks
31
31
2. The test (and reports the result)
32
32
3. Any "after each" hooks
33
33
13. If the current suite has a child suite, repeat the steps in 10. for each child suite; each child suite _inherits_ any "before each" and "after each" hooks defined in its parent
34
-
14. Any "after all" hooks (for the _root_ suite, this only happens once; see [root hook plugins](/next/features/root-hook-plugins))
34
+
14. Any "after all" hooks (for the _root_ suite, this only happens once; see [root hook plugins](/features/root-hook-plugins))
35
35
15. Mocha prints a final summary/epilog, if applicable
36
-
16. Mocha runs [global teardown fixtures](/next/features/global-fixtures#global-teardown-fixtures), if any
36
+
16. Mocha runs [global teardown fixtures](/features/global-fixtures#global-teardown-fixtures), if any
37
37
38
38
## Parallel Mode
39
39
40
40
1. Repeat steps 1 through 6 from [Serial Mode](#serial-mode) above, skipping reporter validation
41
41
2. All test files found are put into a queue (they are _not_ loaded by the main process)
42
-
3. Mocha runs [global setup fixtures](/next/features/global-fixtures#global-setup-fixtures), if any
42
+
3. Mocha runs [global setup fixtures](/features/global-fixtures#global-setup-fixtures), if any
43
43
4. Mocha creates a pool of subprocesses ("workers")
44
44
5._Immediately before_ a worker runs the first test it receives, the worker "bootstraps" itself by:
45
45
1. Loading all `--require`'d modules
@@ -52,4 +52,4 @@ In a browser, test files are loaded by `<script>` tags, and calling `mocha.run()
52
52
9. When the worker completes the test file, buffered results are returned to the main process, which then gives them to the user-specified reporter (`spec` by default)
53
53
10. The worker makes itself available to the pool; the pool gives the worker another test file to run, if any remain
54
54
11. Mocha prints a final summary/epilog, if applicable
55
-
12. Mocha runs [global teardown fixtures](/next/features/global-fixtures#global-teardown-fixtures), if any
55
+
12. Mocha runs [global teardown fixtures](/features/global-fixtures#global-teardown-fixtures), if any
Copy file name to clipboardExpand all lines: docs-next/src/content/docs/explainers/test-fixture-decision-tree.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ description: Helping you decide which API(s) to use for your test fixtures.
3
3
title: Test Fixture Decision Tree
4
4
---
5
5
6
-
This flowchart will help you decide when to use [hooks](/next/features/hooks), [root hook plugins](/next/features/root-hook-plugins) or [global fixtures](/next/features/global-fixtures).
6
+
This flowchart will help you decide when to use [hooks](/features/hooks), [root hook plugins](/features/root-hook-plugins) or [global fixtures](/features/global-fixtures).
0 commit comments