File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 11# Node.js Core Test Common Modules
22
33This directory contains modules used to test the Node.js implementation.
4+ All tests must begin by requiring the ` common ` module:
5+
6+ ``` js
7+ require (' ../common' );
8+ ```
9+
10+ This is not just a convenience for exporting helper functions etc; it also performs
11+ several other tasks:
12+
13+ * Verifies that no unintended globals have been leaked to ensure that tests
14+ don't accidentally pollute the global namespace.
15+
16+ * Some tests assume a default umask of ` 0o022 ` . To enforce this assumption,
17+ the common module sets the unmask at startup. Tests that require a
18+ different umask can override this setting after loading the module.
19+
20+ * Some tests specify runtime flags (example, ` --expose-internals ` ) via a
21+ comment at the top of the file: ` // Flags: --expose-internals ` .
22+ If the test is run without those flags, the common module automatically
23+ spawns a child process with proper flags. This ensures that the tests
24+ always run under the expected conditions. Because of this behaviour, the
25+ common module must be loaded first so that any code below it is not
26+ executed until the process has been re-spawned with the correct flags.
427
528## Table of contents
629
You can’t perform that action at this time.
0 commit comments