Skip to content

doc: update testing documentation #56953

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

Merged
merged 2 commits into from
Feb 15, 2025
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
23 changes: 23 additions & 0 deletions test/common/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Node.js Core Test Common Modules

This directory contains modules used to test the Node.js implementation.
All tests must begin by requiring the `common` module:

```js
require('../common');
```

This is not just a convenience for exporting helper functions etc; it also performs
several other tasks:

* Verifies that no unintended globals have been leaked to ensure that tests
don't accidentally pollute the global namespace.

* Some tests assume a default umask of `0o022`. To enforce this assumption,
the common module sets the unmask at startup. Tests that require a
different umask can override this setting after loading the module.

* Some tests specify runtime flags (example, `--expose-internals`) via a
comment at the top of the file: `// Flags: --expose-internals`.
If the test is run without those flags, the common module automatically
spawns a child process with proper flags. This ensures that the tests
always run under the expected conditions. Because of this behaviour, the
common module must be loaded first so that any code below it is not
executed until the process has been re-spawned with the correct flags.

## Table of contents

Expand Down
Loading