-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
doc: add restrictions around node:test usage #56027
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,26 @@ request. Interesting things to notice: | |
|
|
||
| ## General recommendations | ||
|
|
||
| ### Usage of `node:test` | ||
|
|
||
| It is recommended to use `node:test` in tests outside of testing the `node:test` | ||
| module, if particular functionality that's tested is not a dependency of | ||
| `node:test` module. This ensures that a bug in the test runner doesn't impact | ||
| the outcome of the underlying dependencies' test results. | ||
anonrig marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| These dependencies are: | ||
|
|
||
| - `node:async_hooks` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me, but before removing the rest, what's your reasoning for keeping only
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The only place the test runner uses a stream is for emitting events. If you were going to include that, you may as well include event emitter as well since it is part of streams. The Also worth noting that the test runner is already used to test the test runner itself 😄
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you recommend changes to the text, please?
anonrig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - `node:child_process` | ||
| - `node:fs` | ||
| - ReadableStream in `node:streams` | ||
anonrig marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `node:vm` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the files listed in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean? I don't follow
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably worth adding anything related to the bootstrapping process to the list of things not to test with the test runner since I'm not sure you can be 100% certain the test runner itself is bootstrapped properly at that point.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Most of) the files listed there are essential parts of the Node.js functionality that are used more ubiquitously, hence more likely to be depended on by
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you recommend changes to the text, please? |
||
|
|
||
| #### Caveats | ||
|
|
||
| * `node:url` is excluded due to the extensive testing on web-platform tests. | ||
| * `node:path` and `node:os` is excluded due to being used by both test runners. | ||
|
|
||
| ### Timers | ||
|
|
||
| Avoid timers unless the test is specifically testing timers. There are multiple | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.