test_runner: preserve user flags in argv#61858
Open
Han5991 wants to merge 1 commit intonodejs:mainfrom
Open
Conversation
This commit fixes an issue where user-specified flags were being stripped from process.argv when running with the --test flag. It ensures that arguments following '--' or starting with '-' (that are not consumed by Node.js options) are correctly passed to the test process. Fixes: nodejs#61852
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61858 +/- ##
==========================================
+ Coverage 89.72% 89.73% +0.01%
==========================================
Files 675 675
Lines 204806 204826 +20
Branches 39355 39358 +3
==========================================
+ Hits 183761 183803 +42
+ Misses 13330 13295 -35
- Partials 7715 7728 +13
🚀 New features to boost your workflow:
|
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.
Fixes: #61852
This PR fixes an issue where user-specified flags were being stripped from
process.argvwhen running with the--testflag.Previously, the test runner treated all arguments as potential file patterns, ignoring flags that weren't specific to the test runner. This made it impossible to pass custom flags (e.g.,
--hello) to test files.This change ensures that:
--are correctly treated as user arguments.-(that are not consumed by Node.js or the test runner) are preserved and passed to the test process.Added new tests in
test/parallel/test-runner-cli-args.jsto verify:node --test fixture.js --hellonode --test fixture.js -- --hellonode --test fixture.js --hello -- world