From 6bcaa30c6c23f3088647b0035da5bd41e9ca06c2 Mon Sep 17 00:00:00 2001 From: karthikreddy-artist Date: Fri, 17 Jul 2026 00:24:34 +0530 Subject: [PATCH] test_runner: do not read from process.argv and process.cwd() in run() Fixes: https://github.com/nodejs/node/issues/53867 --- lib/internal/main/test_runner.js | 1 + lib/internal/test_runner/runner.js | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/internal/main/test_runner.js b/lib/internal/main/test_runner.js index fda47897da9f06..adafb1862ecc64 100644 --- a/lib/internal/main/test_runner.js +++ b/lib/internal/main/test_runner.js @@ -31,6 +31,7 @@ if (isUsingInspector() && options.isolation === 'process') { } options.globPatterns = ArrayPrototypeSlice(process.argv, 1); +options.cwd = process.cwd(); debug('test runner configuration:', options); run(options).on('test:summary', (data) => { diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js index dc6529c220539a..9593e2692e5f32 100644 --- a/lib/internal/test_runner/runner.js +++ b/lib/internal/test_runner/runner.js @@ -90,7 +90,6 @@ const { convertStringToRegExp, countCompletedTest, kDefaultPattern, - parseCommandLine, } = require('internal/test_runner/utils'); const { validateAndCanonicalizeTagFilter, @@ -730,7 +729,7 @@ function run(options = kEmptyObject) { randomSeed: suppliedRandomSeed, execArgv = [], argv = [], - cwd = process.cwd(), + cwd, rerunFailuresFilePath, env, } = options; @@ -918,10 +917,7 @@ function run(options = kEmptyObject) { const rootTestOptions = { __proto__: null, concurrency, timeout, signal }; const globalOptions = { __proto__: null, - // parseCommandLine() should not be used here. However, The existing run() - // behavior has relied on it, so removing it must be done in a semver major. - ...parseCommandLine(), - setup, // This line can be removed when parseCommandLine() is removed here. + ...options, coverage, coverageExcludeGlobs, coverageIncludeGlobs,