nodejs / nodejs/node

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

Aperta
#64,109 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
122k
Fork
37.3k
Merge medio
4g 2h
PR unite (30g)
283

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo entrambi i casi con i comandi node --test indicati nell’issue e segui la gestione degli argomenti della CLI di test_runner. Il lavoro è completato quando i percorsi posizionali non vengono scartati silenziosamente: i percorsi senza corrispondenza producono un avviso o un errore, e l’opzione reporter viene accettata dopo gli argomenti posizionali oppure viene segnalata chiaramente come non valida.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, node.js
Ambito
cli, testing-qa
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
58/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.