22
33This directory contains modules used to test the Node.js implementation.
44
5- ## Table of Contents
5+ ## Table of contents
66
77* [ ArrayStream module] ( #arraystream-module )
88* [ Benchmark module] ( #benchmark-module )
@@ -20,13 +20,14 @@ This directory contains modules used to test the Node.js implementation.
2020* [ HTTP2 module] ( #http2-module )
2121* [ Internet module] ( #internet-module )
2222* [ ongc module] ( #ongc-module )
23+ * [ process-exit-code-test-cases module] ( #process-exit-code-test-cases-module )
2324* [ Report module] ( #report-module )
2425* [ tick module] ( #tick-module )
2526* [ tmpdir module] ( #tmpdir-module )
2627* [ UDP pair helper] ( #udp-pair-helper )
2728* [ WPT module] ( #wpt-module )
2829
29- ## Benchmark Module
30+ ## Benchmark module
3031
3132The ` benchmark ` module is used by tests to run benchmarks.
3233
@@ -36,7 +37,7 @@ The `benchmark` module is used by tests to run benchmarks.
3637* ` env ` [ \< Object>] [ <Object> ] Environment variables to be applied during the
3738 run.
3839
39- ## Child Process Module
40+ ## Child Process module
4041
4142The ` child_process ` module is used by tests that launch child processes.
4243
@@ -80,7 +81,7 @@ Similar to `expectSyncExit()` with the `status` expected to be 0 and
8081Similar to ` spawnSyncAndExitWithoutError() ` , but with an additional
8182` expectations ` parameter.
8283
83- ## Common Module API
84+ ## Common module API
8485
8586The ` common ` module is used by tests for consistency across repeated
8687tasks.
@@ -489,7 +490,7 @@ was compiled with a pointer size smaller than 64 bits.
489490Skip the rest of the tests in the current file when not running on a main
490491thread.
491492
492- ## ArrayStream Module
493+ ## ArrayStream module
493494
494495The ` ArrayStream ` module provides a simple ` Stream ` that pushes elements from
495496a given array.
@@ -504,7 +505,7 @@ stream.run(['a', 'b', 'c']);
504505
505506It can be used within tests as a simple mock stream.
506507
507- ## Countdown Module
508+ ## Countdown module
508509
509510The ` Countdown ` module provides a simple countdown mechanism for tests that
510511require a particular action to be taken after a given number of completed
@@ -608,7 +609,7 @@ used to interact with the `node inspect` CLI. These functions are:
608609* ` stepCommand() `
609610* ` quit() `
610611
611- ## ` DNS ` Module
612+ ## ` DNS ` module
612613
613614The ` DNS ` module provides utilities related to the ` dns ` built-in module.
614615
@@ -707,7 +708,7 @@ A comma-separated list of variables names that are appended to the global
707708variable allowlist. Alternatively, if ` NODE_TEST_KNOWN_GLOBALS ` is set to ` '0' ` ,
708709global leak detection is disabled.
709710
710- ## Fixtures Module
711+ ## Fixtures module
711712
712713The ` common/fixtures ` module provides convenience methods for working with
713714files in the ` test/fixtures ` directory.
@@ -782,7 +783,7 @@ validateSnapshotNodes('TLSWRAP', [
782783]);
783784```
784785
785- ## hijackstdio Module
786+ ## hijackstdio module
786787
787788The ` hijackstdio ` module provides utility functions for temporarily redirecting
788789` stdout ` and ` stderr ` output.
@@ -830,7 +831,7 @@ original state after calling [`hijackstdio.hijackStdErr()`][].
830831Restore the original ` process.stdout.write() ` . Used to restore ` stdout ` to its
831832original state after calling [ ` hijackstdio.hijackStdOut() ` ] [ ] .
832833
833- ## HTTP/2 Module
834+ ## HTTP/2 module
834835
835836The http2.js module provides a handful of utilities for creating mock HTTP/2
836837frames for testing of HTTP/2 endpoints
@@ -949,7 +950,7 @@ upon initial establishment of a connection.
949950socket .write (http2 .kClientMagic );
950951```
951952
952- ## Internet Module
953+ ## Internet module
953954
954955The ` common/internet ` module provides utilities for working with
955956internet-related tests.
@@ -983,7 +984,7 @@ via `NODE_TEST_*` environment variables. For example, to configure
983984` internet.addresses.INET_HOST ` , set the environment
984985variable ` NODE_TEST_INET_HOST ` to a specified host.
985986
986- ## ongc Module
987+ ## ongc module
987988
988989The ` ongc ` module allows a garbage collection listener to be installed. The
989990module exports a single ` onGC() ` function.
@@ -1011,7 +1012,28 @@ a full `setImmediate()` invocation passes.
10111012` listener ` is an object to make it easier to use a closure; the target object
10121013should not be in scope when ` listener.ongc() ` is created.
10131014
1014- ## Report Module
1015+ ## process-exit-code-test-cases module
1016+
1017+ The ` process-exit-code-test-cases ` module provides a set of shared test cases
1018+ for testing the exit codes of the ` process ` object. The test cases are shared
1019+ between ` test/parallel/test-process-exit-code.js ` and
1020+ ` test/parallel/test-worker-exit-code.js ` .
1021+
1022+ ### ` getTestCases(isWorker) `
1023+
1024+ * ` isWorker ` [ \< boolean>] [ <boolean> ]
1025+ * return [ \< Array>] [ <Array> ]
1026+
1027+ Returns an array of test cases for testing the exit codes of the ` process ` . Each
1028+ test case is an object with a ` func ` property that is a function that runs the
1029+ test case, a ` result ` property that is the expected exit code, and sometimes an
1030+ ` error ` property that is a regular expression that the error message should
1031+ match when the test case is run in a worker thread.
1032+
1033+ The ` isWorker ` parameter is used to adjust the test cases for worker threads.
1034+ The default value is ` false ` .
1035+
1036+ ## Report module
10151037
10161038The ` report ` module provides helper functions for testing diagnostic reporting
10171039functionality.
@@ -1060,7 +1082,7 @@ into `targetExecutable` and sign it if necessary.
10601082If ` verifyWorkflow ` is false (default) and any of the steps fails,
10611083it skips the tests. Otherwise, an error is thrown.
10621084
1063- ## tick Module
1085+ ## tick module
10641086
10651087The ` tick ` module provides a helper function that can be used to call a callback
10661088after a given number of event loop "ticks".
@@ -1070,7 +1092,7 @@ after a given number of event loop "ticks".
10701092* ` x ` [ \< number>] [ <number> ] Number of event loop "ticks".
10711093* ` cb ` [ \< Function>] [ <Function> ] A callback function.
10721094
1073- ## tmpdir Module
1095+ ## tmpdir module
10741096
10751097The ` tmpdir ` module supports the use of a temporary directory for testing.
10761098
@@ -1138,7 +1160,7 @@ is an `FakeUDPWrap` connected to the other side.
11381160
11391161There is no difference between client or server side beyond their names.
11401162
1141- ## WPT Module
1163+ ## WPT module
11421164
11431165### ` harness `
11441166
0 commit comments