Skip to content

Commit 5e25c2a

Browse files
authored
doc: cover --experimental-test-module-mocks flag
PR-URL: #55021 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent cfe58cf commit 5e25c2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/api/test.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -2112,8 +2112,10 @@ added: v22.3.0
21122112

21132113
This function is used to mock the exports of ECMAScript modules, CommonJS
21142114
modules, and Node.js builtin modules. Any references to the original module
2115-
prior to mocking are not impacted. The following example demonstrates how a mock
2116-
is created for a module.
2115+
prior to mocking are not impacted. In order to enable module mocking, Node.js must
2116+
be started with the [`--experimental-test-module-mocks`][] command-line flag.
2117+
2118+
The following example demonstrates how a mock is created for a module.
21172119

21182120
```js
21192121
test('mocks a builtin module in both module systems', async (t) => {
@@ -3561,6 +3563,7 @@ Can be used to abort test subtasks when the test has been aborted.
35613563

35623564
[TAP]: https://testanything.org/
35633565
[`--experimental-test-coverage`]: cli.md#--experimental-test-coverage
3566+
[`--experimental-test-module-mocks`]: cli.md#--experimental-test-module-mocks
35643567
[`--experimental-test-snapshots`]: cli.md#--experimental-test-snapshots
35653568
[`--import`]: cli.md#--importmodule
35663569
[`--test-concurrency`]: cli.md#--test-concurrency

0 commit comments

Comments
 (0)