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

Abierto
#967 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cypress, typescript
Área
testing

Línea de trabajo

Comienza rastreando cómo la configuración de Cypress lee los ajustes de NYC y cómo el plugin descubre actualmente los archivos .nycrc predeterminados. Revisa las pruebas existentes de configuración y cobertura; después, verifica la compatibilidad con una ruta personalizada proporcionada mediante config.nycrcPath o config.env.nycrcPath. Se considera terminado cuando Cypress utiliza la configuración seleccionada y conserva el comportamiento predeterminado existente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
440
Forks
114
Merge medio
42 min
PR fusionados (30 d)
19

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cypress-io/code-coverage

Todos los issues de cypress-io/code-coverage

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.