Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Using `--test` causes process.argv[] to lose user-specified CLI flags | GoodFirstPicks

Using `--test` causes process.argv[] to lose user-specified CLI flags

nodejs/node 3 comments 1mo ago
View on GitHub
lowopenScope: clearSkill match: yesTest focusedNode.jsJavaScript

Why this is a good first issue

The issue clearly demonstrates a discrepancy in process.argv handling when using --test flag.

AI Summary

The problem involves process.argv not including user-specified CLI flags when --test is used. The fix likely requires modifying how the test runner processes arguments. No major blockers are apparent from the description.

Issue 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 both with and without the --test flag:

# Run script with a custom CLI flag (without --test):
$ node foo.js --hello
[
  '/Users/kieffer/.nvm/versions/node/v25.6.1/bin/node',
  '/Users/kieffer/codepen/codewatch/packages/foo.js',
  '--hello'
]

# ... now add `--test`:
$ 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.

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • potential interaction with test runner internals
Loading labels...

Details

Points10 pts
Difficultylow
Scopeclear
Skill Matchyes
Test Focusedyes