Skip to content

Commit c2edafb

Browse files
committed
replace CLI flag with environment variable
1 parent b51a68a commit c2edafb

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

lib/internal/test_runner/runner.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ function getRunArgs({ path, inspectPort }) {
145145
ArrayPrototypePush(argv, `--inspect-port=${getInspectPort(inspectPort)}`);
146146
}
147147
ArrayPrototypePush(argv, path);
148-
ArrayPrototypeUnshift(argv, '--test-child-process');
149148

150149
return argv;
151150
}
@@ -262,7 +261,7 @@ function runTestFile(path, root, inspectPort, filesWatcher) {
262261
const subtest = root.createSubtest(FileTest, path, async (t) => {
263262
const args = getRunArgs({ path, inspectPort });
264263
const stdio = ['pipe', 'pipe', 'pipe'];
265-
const env = { ...process.env };
264+
const env = { ...process.env, TEST_CONTEXT: 'child' };
266265
if (filesWatcher) {
267266
stdio.push('ipc');
268267
env.WATCH_REPORT_DEPENDENCIES = '1';

lib/internal/test_runner/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
SafeMap,
1010
Symbol,
1111
} = primordials;
12+
1213
const { basename } = require('path');
1314
const { createWriteStream } = require('fs');
1415
const { pathToFileURL } = require('internal/url');
@@ -174,7 +175,7 @@ function parseCommandLine() {
174175
const coverage = getOptionValue('--experimental-test-coverage');
175176
let destinations = getOptionValue('--test-reporter-destination');
176177
let reporters = getOptionValue('--test-reporter');
177-
const isChildProcess = getOptionValue('--test-child-process');
178+
const isChildProcess = process.env.TEST_CONTEXT === 'child';
178179
let testNamePatterns;
179180
let testOnlyFlag;
180181

src/node_options.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
596596
"report given reporter to the given destination",
597597
&EnvironmentOptions::test_reporter_destination,
598598
kAllowedInEnvvar);
599-
AddOption("--test-child-process",
600-
"", // for internal use by test runner
601-
&EnvironmentOptions::test_child_process);
602599
AddOption("--test-only",
603600
"run tests with 'only' option set",
604601
&EnvironmentOptions::test_only,

0 commit comments

Comments
 (0)