nodejs / nodejs/node

test_runner: `node --test` silently drops options or args in certain cases

Abierto
#64,109 1 comentario 0 reacciones 0 asignados Ver en GitHub

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

v26.3.0

Subsystem

test_runner

What steps will reproduce the bug?

Either of the following:

node --test no-tests-here "spec/*.test.js"

node --test "spec/*.test.js" --test-reporter tap
What is the expected behavior? Why is that the expected behavior?

In the first case, since positional args are taken as a path or glob for tests to be run, each arg should result in at least one test found and successfully run, else a warning or error should be printed, e.g.:

No tests were found at "no-tests-here".

In the second case, ideally the CLI parsing is changed to allow options to come after positional args (see also #51384 and nodejs/test-runner#13), and --test-reporter tap results in the TAP test reporter being used. If that is not possible, then warnings or errors like the first case:

No tests were found at "--test-reporter".
No tests were found at "tap".

The reason for the warnings or errors is that when a positional arg does not resolve to a single test file, it is most likely a user mistake/typo, or as in the second case, the natural but incorrect assumption that options can be specified at the end.

What do you see instead?

"no-tests-here" in the first case and "--test-reporter tap" in the second are dropped without warning or error.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza reproduciendo ambos casos con los comandos node --test indicados en el issue y siguiendo el manejo de los argumentos de la CLI de test_runner. Se considera terminado cuando las rutas posicionales no se descartan silenciosamente: las rutas que no coincidan producen una advertencia o un error, y la opción reporter se acepta después de los argumentos posicionales o se informa claramente de que no es válida.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, node.js
Área
cli, testing-qa
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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.