Skip to content

Commit

Permalink
replace CLI flag with environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
SRHerzog committed Mar 6, 2023
1 parent b51a68a commit c2edafb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/internal/test_runner/runner.js
Expand Up @@ -145,7 +145,6 @@ function getRunArgs({ path, inspectPort }) {
ArrayPrototypePush(argv, `--inspect-port=${getInspectPort(inspectPort)}`);
}
ArrayPrototypePush(argv, path);
ArrayPrototypeUnshift(argv, '--test-child-process');

return argv;
}
Expand Down Expand Up @@ -262,7 +261,7 @@ function runTestFile(path, root, inspectPort, filesWatcher) {
const subtest = root.createSubtest(FileTest, path, async (t) => {
const args = getRunArgs({ path, inspectPort });
const stdio = ['pipe', 'pipe', 'pipe'];
const env = { ...process.env };
const env = { ...process.env, TEST_CONTEXT: 'child' };
if (filesWatcher) {
stdio.push('ipc');
env.WATCH_REPORT_DEPENDENCIES = '1';
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/test_runner/utils.js
Expand Up @@ -9,6 +9,7 @@ const {
SafeMap,
Symbol,
} = primordials;

const { basename } = require('path');
const { createWriteStream } = require('fs');
const { pathToFileURL } = require('internal/url');
Expand Down Expand Up @@ -174,7 +175,7 @@ function parseCommandLine() {
const coverage = getOptionValue('--experimental-test-coverage');
let destinations = getOptionValue('--test-reporter-destination');
let reporters = getOptionValue('--test-reporter');
const isChildProcess = getOptionValue('--test-child-process');
const isChildProcess = process.env.TEST_CONTEXT === 'child';
let testNamePatterns;
let testOnlyFlag;

Expand Down
3 changes: 0 additions & 3 deletions src/node_options.cc
Expand Up @@ -596,9 +596,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"report given reporter to the given destination",
&EnvironmentOptions::test_reporter_destination,
kAllowedInEnvvar);
AddOption("--test-child-process",
"", // for internal use by test runner
&EnvironmentOptions::test_child_process);
AddOption("--test-only",
"run tests with 'only' option set",
&EnvironmentOptions::test_only,
Expand Down

0 comments on commit c2edafb

Please sign in to comment.