| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e326342 commit 77761af
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | This directory contains modules used to test the Node.js implementation. | |
| 4 | 4 | ||
| 5 | - ## Table of Contents | ||
| 5 | + ## Table of contents | ||
| 6 | 6 | ||
| 7 | 7 | * [ArrayStream module](#arraystream-module) | |
| 8 | 8 | * [Benchmark module](#benchmark-module) | |
@@ -19,13 +19,14 @@ This directory contains modules used to test the Node.js implementation. | |||
| 19 | 19 | * [HTTP2 module](#http2-module) | |
| 20 | 20 | * [Internet module](#internet-module) | |
| 21 | 21 | * [ongc module](#ongc-module) | |
| 22 | + * [process-exit-code-test-cases module](#process-exit-code-test-cases-module) | ||
| 22 | 23 | * [Report module](#report-module) | |
| 23 | 24 | * [tick module](#tick-module) | |
| 24 | 25 | * [tmpdir module](#tmpdir-module) | |
| 25 | 26 | * [UDP pair helper](#udp-pair-helper) | |
| 26 | 27 | * [WPT module](#wpt-module) | |
| 27 | 28 | ||
| 28 | - ## Benchmark Module | ||
| 29 | + ## Benchmark module | ||
| 29 | 30 | ||
| 30 | 31 | The `benchmark` module is used by tests to run benchmarks. | |
| 31 | 32 | ||
@@ -35,7 +36,7 @@ The `benchmark` module is used by tests to run benchmarks. | |||
| 35 | 36 | * `env` [\<Object>][<Object>] Environment variables to be applied during the | |
| 36 | 37 | run. | |
| 37 | 38 | ||
| 38 | - ## Child Process Module | ||
| 39 | + ## Child Process module | ||
| 39 | 40 | ||
| 40 | 41 | The `child_process` module is used by tests that launch child processes. | |
| 41 | 42 | ||
@@ -79,7 +80,7 @@ Similar to `expectSyncExit()` with the `status` expected to be 0 and | |||
| 79 | 80 | Similar to `spawnSyncAndExitWithoutError()`, but with an additional | |
| 80 | 81 | `expectations` parameter. | |
| 81 | 82 | ||
| 82 | - ## Common Module API | ||
| 83 | + ## Common module API | ||
| 83 | 84 | ||
| 84 | 85 | The `common` module is used by tests for consistency across repeated | |
| 85 | 86 | tasks. | |
@@ -488,7 +489,7 @@ was compiled with a pointer size smaller than 64 bits. | |||
| 488 | 489 | Skip the rest of the tests in the current file when not running on a main | |
| 489 | 490 | thread. | |
| 490 | 491 | ||
| 491 | - ## ArrayStream Module | ||
| 492 | + ## ArrayStream module | ||
| 492 | 493 | ||
| 493 | 494 | The `ArrayStream` module provides a simple `Stream` that pushes elements from | |
| 494 | 495 | a given array. | |
@@ -503,7 +504,7 @@ stream.run(['a', 'b', 'c']); | |||
| 503 | 504 | ||
| 504 | 505 | It can be used within tests as a simple mock stream. | |
| 505 | 506 | ||
| 506 | - ## Countdown Module | ||
| 507 | + ## Countdown module | ||
| 507 | 508 | ||
| 508 | 509 | The `Countdown` module provides a simple countdown mechanism for tests that | |
| 509 | 510 | require 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: | |||
| 607 | 608 | * `stepCommand()` | |
| 608 | 609 | * `quit()` | |
| 609 | 610 | ||
| 610 | - ## `DNS` Module | ||
| 611 | + ## `DNS` module | ||
| 611 | 612 | ||
| 612 | 613 | The `DNS` module provides utilities related to the `dns` built-in module. | |
| 613 | 614 | ||
@@ -698,7 +699,7 @@ A comma-separated list of variables names that are appended to the global | |||
| 698 | 699 | variable allowlist. Alternatively, if `NODE_TEST_KNOWN_GLOBALS` is set to `'0'`, | |
| 699 | 700 | global leak detection is disabled. | |
| 700 | 701 | ||
| 701 | - ## Fixtures Module | ||
| 702 | + ## Fixtures module | ||
| 702 | 703 | ||
| 703 | 704 | The `common/fixtures` module provides convenience methods for working with | |
| 704 | 705 | files in the `test/fixtures` directory. | |
@@ -773,7 +774,7 @@ validateSnapshotNodes('TLSWRAP', [ | |||
| 773 | 774 | ]); | |
| 774 | 775 | ``` | |
| 775 | 776 | ||
| 776 | - ## hijackstdio Module | ||
| 777 | + ## hijackstdio module | ||
| 777 | 778 | ||
| 778 | 779 | The `hijackstdio` module provides utility functions for temporarily redirecting | |
| 779 | 780 | `stdout` and `stderr` output. | |
@@ -821,7 +822,7 @@ original state after calling [`hijackstdio.hijackStdErr()`][]. | |||
| 821 | 822 | Restore the original `process.stdout.write()`. Used to restore `stdout` to its | |
| 822 | 823 | original state after calling [`hijackstdio.hijackStdOut()`][]. | |
| 823 | 824 | ||
| 824 | - ## HTTP/2 Module | ||
| 825 | + ## HTTP/2 module | ||
| 825 | 826 | ||
| 826 | 827 | The http2.js module provides a handful of utilities for creating mock HTTP/2 | |
| 827 | 828 | frames for testing of HTTP/2 endpoints | |
@@ -940,7 +941,7 @@ upon initial establishment of a connection. | |||
| 940 | 941 | socket.write(http2.kClientMagic); | |
| 941 | 942 | ``` | |
| 942 | 943 | ||
| 943 | - ## Internet Module | ||
| 944 | + ## Internet module | ||
| 944 | 945 | ||
| 945 | 946 | The `common/internet` module provides utilities for working with | |
| 946 | 947 | internet-related tests. | |
@@ -974,7 +975,7 @@ via `NODE_TEST_*` environment variables. For example, to configure | |||
| 974 | 975 | `internet.addresses.INET_HOST`, set the environment | |
| 975 | 976 | variable `NODE_TEST_INET_HOST` to a specified host. | |
| 976 | 977 | ||
| 977 | - ## ongc Module | ||
| 978 | + ## ongc module | ||
| 978 | 979 | ||
| 979 | 980 | The `ongc` module allows a garbage collection listener to be installed. The | |
| 980 | 981 | module exports a single `onGC()` function. | |
@@ -1002,7 +1003,28 @@ a full `setImmediate()` invocation passes. | |||
| 1002 | 1003 | `listener` is an object to make it easier to use a closure; the target object | |
| 1003 | 1004 | should not be in scope when `listener.ongc()` is created. | |
| 1004 | 1005 | ||
| 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 | ||
| 1006 | 1028 | ||
| 1007 | 1029 | The `report` module provides helper functions for testing diagnostic reporting | |
| 1008 | 1030 | functionality. | |
@@ -1051,7 +1073,7 @@ into `targetExecutable` and sign it if necessary. | |||
| 1051 | 1073 | If `verifyWorkflow` is false (default) and any of the steps fails, | |
| 1052 | 1074 | it skips the tests. Otherwise, an error is thrown. | |
| 1053 | 1075 | ||
| 1054 | - ## tick Module | ||
| 1076 | + ## tick module | ||
| 1055 | 1077 | ||
| 1056 | 1078 | The `tick` module provides a helper function that can be used to call a callback | |
| 1057 | 1079 | after a given number of event loop "ticks". | |
@@ -1061,7 +1083,7 @@ after a given number of event loop "ticks". | |||
| 1061 | 1083 | * `x` [\<number>][<number>] Number of event loop "ticks". | |
| 1062 | 1084 | * `cb` [\<Function>][<Function>] A callback function. | |
| 1063 | 1085 | ||
| 1064 | - ## tmpdir Module | ||
| 1086 | + ## tmpdir module | ||
| 1065 | 1087 | ||
| 1066 | 1088 | The `tmpdir` module supports the use of a temporary directory for testing. | |
| 1067 | 1089 | ||
@@ -1129,7 +1151,7 @@ is an `FakeUDPWrap` connected to the other side. | |||
| 1129 | 1151 | ||
| 1130 | 1152 | There is no difference between client or server side beyond their names. | |
| 1131 | 1153 | ||
| 1132 | - ## WPT Module | ||
| 1154 | + ## WPT module | ||
| 1133 | 1155 | ||
| 1134 | 1156 | ### `harness` | |
| 1135 | 1157 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ function getTestCases(isWorker = false) { | |||
| 36 | 36 | function exitWithOneOnUncaught() { | |
| 37 | 37 | process.exitCode = 99; | |
| 38 | 38 | process.on('exit', (code) => { | |
| 39 | - // cannot use assert because it will be uncaughtException -> 1 exit code | ||
| 39 | + // Cannot use assert because it will be uncaughtException -> 1 exit code | ||
| 40 | 40 | // that will render this test useless | |
| 41 | 41 | if (code !== 1 || process.exitCode !== 1) { | |
| 42 | 42 | console.log('wrong code! expected 1 for uncaughtException'); | |
@@ -113,7 +113,7 @@ function getTestCases(isWorker = false) { | |||
| 113 | 113 | ||
| 114 | 114 | function exitWithThrowInUncaughtHandler() { | |
| 115 | 115 | process.on('uncaughtException', () => { | |
| 116 | - throw new Error('ok') | ||
| 116 | + throw new Error('ok'); | ||
| 117 | 117 | }); | |
| 118 | 118 | throw new Error('bad'); | |
| 119 | 119 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ require('../common'); | |||
| 24 | 24 | const assert = require('assert'); | |
| 25 | 25 | const debug = require('util').debuglog('test'); | |
| 26 | 26 | ||
| 27 | - const { getTestCases } = require('../fixtures/process-exit-code-cases'); | ||
| 27 | + const { getTestCases } = require('../common/process-exit-code-cases'); | ||
| 28 | 28 | const testCases = getTestCases(false); | |
| 29 | 29 | ||
| 30 | 30 | if (!process.argv[2]) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ const assert = require('assert'); | |||
| 8 | 8 | const worker = require('worker_threads'); | |
| 9 | 9 | const { Worker, parentPort } = worker; | |
| 10 | 10 | ||
| 11 | - const { getTestCases } = require('../fixtures/process-exit-code-cases'); | ||
| 11 | + const { getTestCases } = require('../common/process-exit-code-cases'); | ||
| 12 | 12 | const testCases = getTestCases(true); | |
| 13 | 13 | ||
| 14 | 14 | // Do not use isMainThread so that this test itself can be run inside a Worker. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments