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,
tsc does 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 as istanbul-lib-instrument does.
Related issues:
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
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.
tscdoes though)/* v8 ignore ... */) exclude the lines instead of marking them as covered. Exactly asistanbul-lib-instrumentdoes.Related issues:
Suggested solution
Typically PRs in
istanbuljsorganization take long time to land so we could apply the changes aspnpm patchand bundlev8-to-istanbulinto@vitest/coverage-v8package.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.thresholdsmay 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