Commit 5b2dfad 1 parent 40f3a51 commit 5b2dfad Copy full SHA for 5b2dfad
File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Node.js Core Test Common Modules
2
2
3
3
This 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.
4
27
5
28
## Table of contents
6
29
You can’t perform that action at this time.
0 commit comments