-
-
Notifications
You must be signed in to change notification settings - Fork 34.8k
Open
Description
Version
v25.6.1
Platform
Darwin MacBookPro.lan 25.0.0 Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:45 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6000 arm64
Subsystem
node:test
What steps will reproduce the bug?
Create a file, "foo.js":
console.log(process.argv);... then invoke node with a custom CLI flag (--hello), and without and with the --test flag:
# Run script with a custom CLI flag:
$ node foo.js --hello
[
'/Users/kieffer/.nvm/versions/node/v25.6.1/bin/node',
'/Users/kieffer/codepen/codewatch/packages/foo.js',
'--hello'
]
# ... now add the `--test` fla
$ node --test foo.js --hello
[
'/Users/kieffer/.nvm/versions/node/v25.6.1/bin/node',
'/Users/kieffer/codepen/codewatch/packages/foo.js'
]
✔ foo.js (35.9505ms)
<snip>Note
Running with the "--" flag (e.g. node foo.js -- --hello or node --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.argv should include the user-provided CLI flag in both cases.
What do you see instead?
When running with --test, process.argv omits the user-supplied --hello flag.
This makes testing code that depends on process.argv problematic, obviously.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels