cypress-io / cypress-io/code-coverage

Rename and/or replace `coverage:report` script

Open
#545 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
445
Forks
115
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Currently, if you want to have different nyc options for your Cypress tests (for example if you're using a different test runner for unit tests), the only way to pass custom options is to use the `coverage:report` script in `package.json`. This approach is problematic because it's essentially a magic script name—new developers coming on to a project would have no indication what this script is for. What's worse, because it's in `package.json`, you can't even add a code comment to explain it. Your only option is to add something to a README or other documentation and hope that people actually read it.

**Describe the solution you'd like**
The ideal solution would be to make this command (as well as nyc options in general) configurable in `cypress.json` instead of relying on a magic script.

But at the very least, I feel the script should be renamed to something that makes it clear that this is related to Cypress, such as `cypress:coverage:report`. The current name is completely generic, and sounds like it should be used by the developer for generating generalized coverage reports.

**Describe alternatives you've considered**
In theory one workaround for this situation is to simply set the desired nyc config in the project's global `.nycrc` and instead pass a custom config for the other (i.e., unit) test runner. But this is still problematic because it would still not be immediately obvious that the global `.nycrc` config is **actually** specific to Cypress (again, one cannot add comments to it because of the JSON format).

**Additional context**
Just to reiterate, this is chiefly for a scenario where a different nyc config is desired for different test runners.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.