nodejs / nodejs/node

Test runner: --test-reporter-destination should create the folder if not found

Aperta
#64,994 0 commenti 0 reazioni 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

What is the problem this feature will solve?

Hi 👋

Fairly easy one:
I have node --test --experimental-code-coverage --test-reporter-destination="coverage/lcov.info" outputting the coverage file to the coverage folder.

However, if the coverage folder does not exist beforehand, an ENOENT is thrown.

Since storing the behavior of storing coverage in coverage/lcov.info, and having that folder in .gitignore is rather standard, it'd be nice to have Node creating the folder in which it will place the coverage report in case it doesn't exist.

Thanks :)

What is the feature you are proposing to solve the problem?

When writing coverage report, check if the destination folder exists, and if not, create it beforehand

What alternatives have you considered?
  • version controlling the coverage folder with a .gitkeep file, but it's cumbersome
  • Having the CLI test script in my package json create the folder itself, but that's quite inelegant to maintain for both Windows and Unix users
  • Switching to another test runner and losing all the charisma points that come with using the native one

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 il problema con il comando fornito node --test --experimental-code-coverage --test-reporter-destination="coverage/lcov.info" quando coverage non esiste. Traccia la gestione della destinazione del reporter da parte del test runner e verifica che la cartella di destinazione venga creata prima della scrittura del report di coverage, anche quando sono necessarie cartelle annidate.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.