nodejs / nodejs/node

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

Aperta
#64,099 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feature request test_runner
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?
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

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 eseguendo il comando segnalato con one.test.js e two.test.js, quindi esamina l’implementazione di test_runner e i test esistenti per la gestione di --test-name-pattern. Il lavoro è completato quando un file senza test corrispondenti viene omesso e il totale, il conteggio dei test superati e la durata includono solo il test corrispondente riuscito.

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.