| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b3fe2ba commit a5ebc89
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1941,6 +1941,8 @@ Node.js options that are allowed are: | |||
| 1941 | 1941 | * `--secure-heap` | |
| 1942 | 1942 | * `--snapshot-blob` | |
| 1943 | 1943 | * `--test-only` | |
| 1944 | + * `--test-reporter-destination` | ||
| 1945 | + * `--test-reporter` | ||
| 1944 | 1946 | * `--throw-deprecation` | |
| 1945 | 1947 | * `--title` | |
| 1946 | 1948 | * `--tls-cipher-list` | |
@@ -2082,6 +2084,11 @@ If `value` equals `'1'`, the check for a supported platform is skipped during | |||
| 2082 | 2084 | Node.js startup. Node.js might not execute correctly. Any issues encountered | |
| 2083 | 2085 | on unsupported platforms will not be fixed. | |
| 2084 | 2086 | ||
| 2087 | + ### `NODE_TEST_CONTEXT=value` | ||
| 2088 | + | ||
| 2089 | + If `value` equals `'child'`, test reporter options will be overridden and test | ||
| 2090 | + output will be sent to stdout in the TAP format. | ||
| 2091 | + | ||
| 2085 | 2092 | ### `NODE_TLS_REJECT_UNAUTHORIZED=value` | |
| 2086 | 2093 | ||
| 2087 | 2094 | If `value` equals `'0'`, certificate validation is disabled for TLS connections. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,6 +145,7 @@ function getRunArgs({ path, inspectPort }) { | |||
| 145 | 145 | ArrayPrototypePush(argv, `--inspect-port=${getInspectPort(inspectPort)}`); | |
| 146 | 146 | } | |
| 147 | 147 | ArrayPrototypePush(argv, path); | |
| 148 | + | ||
| 148 | 149 | return argv; | |
| 149 | 150 | } | |
| 150 | 151 | ||
@@ -260,7 +261,7 @@ function runTestFile(path, root, inspectPort, filesWatcher) { | |||
| 260 | 261 | const subtest = root.createSubtest(FileTest, path, async (t) => { | |
| 261 | 262 | const args = getRunArgs({ path, inspectPort }); | |
| 262 | 263 | const stdio = ['pipe', 'pipe', 'pipe']; | |
| 263 | - const env = { ...process.env }; | ||
| 264 | + const env = { ...process.env, NODE_TEST_CONTEXT: 'child' }; | ||
| 264 | 265 | if (filesWatcher) { | |
| 265 | 266 | stdio.push('ipc'); | |
| 266 | 267 | env.WATCH_REPORT_DEPENDENCIES = '1'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ const { | |||
| 8 | 8 | RegExpPrototypeExec, | |
| 9 | 9 | SafeMap, | |
| 10 | 10 | } = primordials; | |
| 11 | + | ||
| 11 | 12 | const { basename } = require('path'); | |
| 12 | 13 | const { createWriteStream } = require('fs'); | |
| 13 | 14 | const { pathToFileURL } = require('internal/url'); | |
@@ -166,25 +167,33 @@ function parseCommandLine() { | |||
| 166 | 167 | ||
| 167 | 168 | const isTestRunner = getOptionValue('--test'); | |
| 168 | 169 | const coverage = getOptionValue('--experimental-test-coverage'); | |
| 169 | - const destinations = getOptionValue('--test-reporter-destination'); | ||
| 170 | - const reporters = getOptionValue('--test-reporter'); | ||
| 170 | + const isChildProcess = process.env.NODE_TEST_CONTEXT === 'child'; | ||
| 171 | + let destinations; | ||
| 172 | + let reporters; | ||
| 171 | 173 | let testNamePatterns; | |
| 172 | 174 | let testOnlyFlag; | |
| 173 | 175 | ||
| 174 | - if (reporters.length === 0 && destinations.length === 0) { | ||
| 175 | - ArrayPrototypePush(reporters, kDefaultReporter); | ||
| 176 | - } | ||
| 176 | + if (isChildProcess) { | ||
| 177 | + reporters = [kDefaultReporter]; | ||
| 178 | + destinations = [kDefaultDestination]; | ||
| 179 | + } else { | ||
| 180 | + destinations = getOptionValue('--test-reporter-destination'); | ||
| 181 | + reporters = getOptionValue('--test-reporter'); | ||
| 182 | + if (reporters.length === 0 && destinations.length === 0) { | ||
| 183 | + ArrayPrototypePush(reporters, kDefaultReporter); | ||
| 184 | + } | ||
| 177 | 185 | ||
| 178 | - if (reporters.length === 1 && destinations.length === 0) { | ||
| 179 | - ArrayPrototypePush(destinations, kDefaultDestination); | ||
| 180 | - } | ||
| 186 | + if (reporters.length === 1 && destinations.length === 0) { | ||
| 187 | + ArrayPrototypePush(destinations, kDefaultDestination); | ||
| 188 | + } | ||
| 181 | 189 | ||
| 182 | - if (destinations.length !== reporters.length) { | ||
| 183 | - throw new ERR_INVALID_ARG_VALUE( | ||
| 184 | - '--test-reporter', | ||
| 185 | - reporters, | ||
| 186 | - 'must match the number of specified \'--test-reporter-destination\'', | ||
| 187 | - ); | ||
| 190 | + if (destinations.length !== reporters.length) { | ||
| 191 | + throw new ERR_INVALID_ARG_VALUE( | ||
| 192 | + '--test-reporter', | ||
| 193 | + reporters, | ||
| 194 | + 'must match the number of specified \'--test-reporter-destination\'', | ||
| 195 | + ); | ||
| 196 | + } | ||
| 188 | 197 | } | |
| 189 | 198 | ||
| 190 | 199 | if (isTestRunner) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -569,10 +569,12 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 569 | 569 | &EnvironmentOptions::test_name_pattern); | |
| 570 | 570 | AddOption("--test-reporter", | |
| 571 | 571 | "report test output using the given reporter", | |
| 572 | - &EnvironmentOptions::test_reporter); | ||
| 572 | + &EnvironmentOptions::test_reporter, | ||
| 573 | + kAllowedInEnvvar); | ||
| 573 | 574 | AddOption("--test-reporter-destination", | |
| 574 | 575 | "report given reporter to the given destination", | |
| 575 | - &EnvironmentOptions::test_reporter_destination); | ||
| 576 | + &EnvironmentOptions::test_reporter_destination, | ||
| 577 | + kAllowedInEnvvar); | ||
| 576 | 578 | AddOption("--test-only", | |
| 577 | 579 | "run tests with 'only' option set", | |
| 578 | 580 | &EnvironmentOptions::test_only, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments