Allow for declaring the nycrcPath to use custom-named configuration files.

Aperta
#967 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cypress, typescript
Ambito
testing

Direzione di ricerca

Inizia tracciando il modo in cui la configurazione di Cypress legge le impostazioni di NYC e il modo in cui il plugin individua attualmente i file .nycrc predefiniti. Controlla i test esistenti per la configurazione e la coverage, quindi verifica il supporto per un percorso personalizzato fornito tramite config.nycrcPath o config.env.nycrcPath. Il lavoro è completato quando Cypress utilizza la configurazione selezionata mantenendo il comportamento predefinito esistente.

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

Descrizione

Is your feature request related to a problem? Please describe.
Right now, this plugin supports loading default named ".nycrcfiles, but cannot utilize a custom named one, like.nycrc.config.cypress.js`. An option to provide custom configuration options exist for other test frameworks, like vitest.

Specifically in the case I am using, I need to have distinct outputs between unit and component test coverage, where Vitest handles unit tests, and Cypress handles component tests. This is due to limitations of how Cypress handles source maps versus Vitest where line lengths do not align properly (and this is well-documented in this repo and in the official nyc repo as well). To avoid that issue, I need separate .nycrc configs for both test frameworks.

Cypress currently only supports default named .nycrc files, or a configuration defined in the package.json, but this limits how we can use nyc as it prefers the configuration used for Cypress over any other configurations that can exist. This is a problem if we need to merge results and report on total coverage combined by both, running nyc report will ignore the files matched in the unit test configuration.

Describe the solution you'd like
The plugin should allow for calling a custom nycrcPath when being declared in the Cypress configuration, either by config.nycrcPath or config.env.nycrcPath.

For an example, see here:
https://github.com/iFaxity/vite-plugin-istanbul?tab=readme-ov-file#istanbulplugin--opts--

Describe alternatives you've considered
I will need to use three .nycrc configurations which is incredibly messy:

  • .nycrc.config.mjs, a default config used only for accurate reporting of merged component + unit test code coverage results. This would be called in a command like npx nyc report --nycrc-path=./.nycrc.config.mjs. Specifying the path is necessary here.
  • .nycrc.config.component.mjs, a Cypress-specific configuration extended from the default; it must be loaded as part of the package.json using "nyc": { "extends": "./.nycrc.config.component.mjs" }. Running npx nyc report without declaring the path will utilize this config instead of the default, which is the main issue.
  • .nycrc.config.unit.mjs for Vitest files only.

Additional context
Add any other context or screenshots about the feature request here.

Lingua principale
TypeScript
Stelle
440
Fork
114
Merge medio
42m
PR unite (30g)
19

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna 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.

Altre issue di cypress-io/code-coverage

Tutte le issue di cypress-io/code-coverage

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.