Using `--test` causes process.argv[] to lose user-specified CLI flags
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
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 -- --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.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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con la reproducción en foo.js y compara process.argv al ejecutar node foo.js --hello con node --test foo.js --hello. Rastrea cómo node:test gestiona los argumentos del script, luego añade una prueba de regresión que muestre que --hello permanece en process.argv y ejecuta las pruebas relevantes del test-runner.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, node.js
- Área
- testing
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 58/100