Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: cover --experimental-test-module-mocks flag #55021

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -2086,8 +2086,10 @@ added: v22.3.0

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

The following example demonstrates how a mock is created for a module.
Comment on lines +2089 to +2092
Copy link
Member

@RedYetiDev RedYetiDev Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC any conditions for this belong in the stability blockquote

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to make this consistent (within the test docs page, at least); other examples using experimental flags, neither of which does so in the blockquote:


```js
test('mocks a builtin module in both module systems', async (t) => {
Expand Down Expand Up @@ -3510,6 +3512,7 @@ Can be used to abort test subtasks when the test has been aborted.

[TAP]: https://testanything.org/
[`--experimental-test-coverage`]: cli.md#--experimental-test-coverage
[`--experimental-test-module-mocks`]: cli.md#--experimental-test-module-mocks
[`--experimental-test-snapshots`]: cli.md#--experimental-test-snapshots
[`--import`]: cli.md#--importmodule
[`--test-concurrency`]: cli.md#--test-concurrency
Expand Down
Loading