You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using --test causes process.argv[] to lose user-specified CLI flags #61852
Version
v25.6.1
Platform
Subsystem
node:test
What steps will reproduce the bug?
Create a file, "foo.js":
... then invoke
nodewith a custom CLI flag (--hello), and both with and without the--testflag:Note
Running with the "--" flag (e.g.
node foo.js -- --helloornode --test foo.js -- --hello) yields the same behavior.How often does it reproduce? Is there a required condition?
Consistent.
What is the expected behavior? Why is that the expected behavior?
process.argvshould include the user-provided CLI flag in both cases.What do you see instead?
When running with
--test,process.argvomits the user-supplied--helloflag.This makes testing code that depends on
process.argvproblematic, obviously.