test_runner: pass processExecArgv and globPatterns to run() instead of reading process directly#63580
Open
AliMahmoudDev wants to merge 2 commits into
Open
test_runner: pass processExecArgv and globPatterns to run() instead of reading process directly#63580AliMahmoudDev wants to merge 2 commits into
AliMahmoudDev wants to merge 2 commits into
Conversation
Collaborator
|
Review requested:
|
…gv directly Captures process.execArgv at the CLI entry point (main/test_runner.js) and passes it through as an explicit option to run(). This removes direct reads of process.execArgv and process.argv inside getRunArgs() in the test runner. Changes: - Add processExecArgv option to run() (defaults to process.execArgv for backward compatibility) - Pass processExecArgv from main/test_runner.js to run() - Replace process.execArgv read in getRunArgs() with the passed option - Replace process.argv read in getRunArgs() with globPatterns Refs: nodejs#53867 Signed-off-by: AliMahmoudDev <123aliactionx5@gmail.com>
f20c005 to
2717a31
Compare
Adds two tests to verify the new processExecArgv option: - Test that processExecArgv defaults to process.execArgv for backward compat - Test that an empty processExecArgv array works correctly Refs: nodejs#53867 Signed-off-by: AliMahmoudDev <123aliactionx5@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Captures
process.execArgvandprocess.argvat the CLI entry point (lib/internal/main/test_runner.js) and passes them through as explicit options torun(). This reduces the coupling between the publicrun()API and global process state.Refs: #53867
Changes
lib/internal/main/test_runner.jsprocess.execArgvat CLI startup and passes it asoptions.processExecArgvtorun()globPatterns(fromprocess.argv[1:]) is already passed torun()(unchanged)lib/internal/test_runner/runner.jsprocessExecArgvoption torun()withprocess.execArgvas backward-compatible defaultprocessExecArgvthrough theoptsobject torunTestFile()andgetRunArgs()process.execArgvread ingetRunArgs()with the passed parameterprocess.argv[1:]read ingetRunArgs()withglobPatternstest/parallel/test-runner-run.mjsprocessExecArgvdefaults toprocess.execArgvfor backward compatibilityprocessExecArgvarray works correctlyBackward Compatibility
The
processExecArgvoption defaults toprocess.execArgv, so existing programmatic callers ofrun()that don't pass this option will continue to work identically.Related
cwdoption torun()process.argvandprocess.cwd()in run() #53867 (open): Parent issue tracking remainingprocessreads inrun()