Skip to content

Commit 6bcaa30

Browse files
test_runner: do not read from process.argv and process.cwd() in run()
Fixes: #53867
1 parent cc8594a commit 6bcaa30

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

lib/internal/main/test_runner.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ if (isUsingInspector() && options.isolation === 'process') {
3131
}
3232

3333
options.globPatterns = ArrayPrototypeSlice(process.argv, 1);
34+
options.cwd = process.cwd();
3435

3536
debug('test runner configuration:', options);
3637
run(options).on('test:summary', (data) => {

lib/internal/test_runner/runner.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ const {
9090
convertStringToRegExp,
9191
countCompletedTest,
9292
kDefaultPattern,
93-
parseCommandLine,
9493
} = require('internal/test_runner/utils');
9594
const {
9695
validateAndCanonicalizeTagFilter,
@@ -730,7 +729,7 @@ function run(options = kEmptyObject) {
730729
randomSeed: suppliedRandomSeed,
731730
execArgv = [],
732731
argv = [],
733-
cwd = process.cwd(),
732+
cwd,
734733
rerunFailuresFilePath,
735734
env,
736735
} = options;
@@ -918,10 +917,7 @@ function run(options = kEmptyObject) {
918917
const rootTestOptions = { __proto__: null, concurrency, timeout, signal };
919918
const globalOptions = {
920919
__proto__: null,
921-
// parseCommandLine() should not be used here. However, The existing run()
922-
// behavior has relied on it, so removing it must be done in a semver major.
923-
...parseCommandLine(),
924-
setup, // This line can be removed when parseCommandLine() is removed here.
920+
...options,
925921
coverage,
926922
coverageExcludeGlobs,
927923
coverageIncludeGlobs,

0 commit comments

Comments
 (0)