test_runner: `node --test` silently drops options or args in certain cases
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, beide Fälle mit den im Issue genannten node --test-Befehlen nachzustellen und die Verarbeitung der Argumente der test_runner CLI nachzuverfolgen. Erledigt ist es, wenn positionale Pfade nicht stillschweigend verworfen werden: Nicht übereinstimmende Pfade erzeugen eine Warnung oder einen Fehler, und die Reporter-Option wird entweder nach positional arguments akzeptiert oder eindeutig als ungültig gemeldet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- cli, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 58/100