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)
@@ -19,13 +19,14 @@ This directory contains modules used to test the Node.js implementation.
1919* [HTTP2 module](#http2-module)
2020* [Internet module](#internet-module)
2121* [ongc module](#ongc-module)
22+ * [process-exit-code-test-cases module](#process-exit-code-test-cases-module)
2223* [Report module](#report-module)
2324* [tick module](#tick-module)
2425* [tmpdir module](#tmpdir-module)
2526* [UDP pair helper](#udp-pair-helper)
2627* [WPT module](#wpt-module)
2728
28- ## Benchmark Module
29+ ## Benchmark module
2930
3031The `benchmark` module is used by tests to run benchmarks.
3132
@@ -35,7 +36,7 @@ The `benchmark` module is used by tests to run benchmarks.
3536* `env` [\<Object>][<Object>] Environment variables to be applied during the
3637 run.
3738
38- ## Child Process Module
39+ ## Child Process module
3940
4041The `child_process` module is used by tests that launch child processes.
4142
@@ -79,7 +80,7 @@ Similar to `expectSyncExit()` with the `status` expected to be 0 and
7980Similar to `spawnSyncAndExitWithoutError()`, but with an additional
8081`expectations` parameter.
8182
82- ## Common Module API
83+ ## Common module API
8384
8485The `common` module is used by tests for consistency across repeated
8586tasks.
@@ -488,7 +489,7 @@ was compiled with a pointer size smaller than 64 bits.
488489Skip the rest of the tests in the current file when not running on a main
489490thread.
490491
491- ## ArrayStream Module
492+ ## ArrayStream module
492493
493494The `ArrayStream` module provides a simple `Stream` that pushes elements from
494495a given array.
@@ -503,7 +504,7 @@ stream.run(['a', 'b', 'c']);
503504
504505It can be used within tests as a simple mock stream.
505506
506- ## Countdown Module
507+ ## Countdown module
507508
508509The `Countdown` module provides a simple countdown mechanism for tests that
509510require a particular action to be taken after a given number of completed
@@ -607,7 +608,7 @@ used to interact with the `node inspect` CLI. These functions are:
607608* `stepCommand()`
608609* `quit()`
609610
610- ## `DNS` Module
611+ ## `DNS` module
611612
612613The `DNS` module provides utilities related to the `dns` built-in module.
613614
@@ -698,7 +699,7 @@ A comma-separated list of variables names that are appended to the global
698699variable allowlist. Alternatively, if `NODE_TEST_KNOWN_GLOBALS` is set to `'0'`,
699700global leak detection is disabled.
700701
701- ## Fixtures Module
702+ ## Fixtures module
702703
703704The `common/fixtures` module provides convenience methods for working with
704705files in the `test/fixtures` directory.
@@ -773,7 +774,7 @@ validateSnapshotNodes('TLSWRAP', [
773774]);
774775```
775776
776- ## hijackstdio Module
777+ ## hijackstdio module
777778
778779The `hijackstdio` module provides utility functions for temporarily redirecting
779780`stdout` and `stderr` output.
@@ -821,7 +822,7 @@ original state after calling [`hijackstdio.hijackStdErr()`][].
821822Restore the original `process.stdout.write()`. Used to restore `stdout` to its
822823original state after calling [`hijackstdio.hijackStdOut()`][].
823824
824- ## HTTP/2 Module
825+ ## HTTP/2 module
825826
826827The http2.js module provides a handful of utilities for creating mock HTTP/2
827828frames for testing of HTTP/2 endpoints
@@ -940,7 +941,7 @@ upon initial establishment of a connection.
940941socket.write(http2.kClientMagic);
941942```
942943
943- ## Internet Module
944+ ## Internet module
944945
945946The `common/internet` module provides utilities for working with
946947internet-related tests.
@@ -974,7 +975,7 @@ via `NODE_TEST_*` environment variables. For example, to configure
974975`internet.addresses.INET_HOST`, set the environment
975976variable `NODE_TEST_INET_HOST` to a specified host.
976977
977- ## ongc Module
978+ ## ongc module
978979
979980The `ongc` module allows a garbage collection listener to be installed. The
980981module exports a single `onGC()` function.
@@ -1002,7 +1003,28 @@ a full `setImmediate()` invocation passes.
10021003`listener` is an object to make it easier to use a closure; the target object
10031004should not be in scope when `listener.ongc()` is created.
10041005
1005- ## Report Module
1006+ ## process-exit-code-test-cases module
1007+
1008+ The `process-exit-code-test-cases` module provides a set of shared test cases
1009+ for testing the exit codes of the `process` object. The test cases are shared
1010+ between `test/parallel/test-process-exit-code.js` and
1011+ `test/parallel/test-worker-exit-code.js`.
1012+
1013+ ### `getTestCases(isWorker)`
1014+
1015+ * `isWorker` [\<boolean>][<boolean>]
1016+ * return [\<Array>][<Array>]
1017+
1018+ Returns an array of test cases for testing the exit codes of the `process`. Each
1019+ test case is an object with a `func` property that is a function that runs the
1020+ test case, a `result` property that is the expected exit code, and sometimes an
1021+ `error` property that is a regular expression that the error message should
1022+ match when the test case is run in a worker thread.
1023+
1024+ The `isWorker` parameter is used to adjust the test cases for worker threads.
1025+ The default value is `false`.
1026+
1027+ ## Report module
10061028
10071029The `report` module provides helper functions for testing diagnostic reporting
10081030functionality.
@@ -1051,7 +1073,7 @@ into `targetExecutable` and sign it if necessary.
10511073If `verifyWorkflow` is false (default) and any of the steps fails,
10521074it skips the tests. Otherwise, an error is thrown.
10531075
1054- ## tick Module
1076+ ## tick module
10551077
10561078The `tick` module provides a helper function that can be used to call a callback
10571079after a given number of event loop "ticks".
@@ -1061,7 +1083,7 @@ after a given number of event loop "ticks".
10611083* `x` [\<number>][<number>] Number of event loop "ticks".
10621084* `cb` [\<Function>][<Function>] A callback function.
10631085
1064- ## tmpdir Module
1086+ ## tmpdir module
10651087
10661088The `tmpdir` module supports the use of a temporary directory for testing.
10671089
@@ -1129,7 +1151,7 @@ is an `FakeUDPWrap` connected to the other side.
11291151
11301152There is no difference between client or server side beyond their names.
11311153
1132- ## WPT Module
1154+ ## WPT module
11331155
11341156### `harness`
11351157
0 commit comments