-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurep3-significantHigh priority enhancement (priority)High priority enhancement (priority)
Description
Clear and concise description of the problem
There's now a PR for improved v8 coverage remapping in v8-to-istanbul:
There are some coverage reports in the linked PR that show what kind of changes it would cause.
- Comments are excluded (esbuild doesn't add comments in source maps,
tscdoes though) - Empty lines are excluded
- Typescript typings are excluded (except enums that compile to actual runtime code)
- HTML-like templates from transpiled languages like Svelte and Vue are excluded, as long as they don't contain code that those compilers consider (user's) runtime code.
- Ignore hints (
/* v8 ignore ... */) exclude the lines instead of marking them as covered. Exactly asistanbul-lib-instrumentdoes.
Related issues:
- Solves many issues listed in Coverage: give the choice between c8 and nyc #1252
- Relates to fix(coverage): v8 to ignore type-only files #5328, types are now also excluded from the files that were run
Suggested solution
Typically PRs in istanbuljs organization take long time to land so we could apply the changes as pnpm patch and bundle v8-to-istanbul into @vitest/coverage-v8 package.
At first we might want to introduce this as opt-in coverage option and enable it by default in V2. The changes that this introduces can affect line coverage in such ways that projects using coverage.thresholds may now fail in CI - exactly as they should do. Line coverage is now more accurate as comments don't increase it.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
cenfun and greguintow
Metadata
Metadata
Assignees
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurep3-significantHigh priority enhancement (priority)High priority enhancement (priority)