nodejs / nodejs/node

test_runner: files without any tests matching `--test-name-pattern` shouldn't be counted or reported

Offen
#64,099 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature request test_runner
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?
echo "const test = require('node:test'); test('good test', (t) => { t.assert.equal(1, 1) })" > one.test.js

echo "const test = require('node:test'); test('bad test', (t) => { t.assert.equal(1, 2) })" > two.test.js

node --test --test-name-pattern=good *.test.js 
How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?
✔ good test (0.963084ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 0.963084ms

The file two.test.js does not contain a single test that matches the --test-name-pattern, so should be skipped entirely, i.e. treated as if it doesn't exist.

What do you see instead?
✔ good test (0.963084ms)
✔ two.test.js (61.52275ms)  <-- file with no matching tests reported (by file name) as passing 
ℹ tests 2                   <-- should be 1 test
ℹ suites 0
ℹ pass 2                    <-- should be 1 pass
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 68.503541     <-- should be 0.963084ms

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den gemeldeten Befehl mit one.test.js und two.test.js auszuführen, und untersuche anschließend die Implementierung von test_runner und die vorhandenen Tests zur Verarbeitung von --test-name-pattern. Als erledigt gilt die Änderung, wenn eine Datei ohne übereinstimmende Tests ausgelassen wird und die Gesamtzahl, die Anzahl der bestandenen Tests und die Dauer nur den übereinstimmenden erfolgreichen Test enthalten.

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
67/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.