docs(coverage): c8 ignore hints actually work #2755
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When writing this part of the guide initially I thought c8's ignore hints would not work, as their regexp is very strict and does not allow additional content such as
@preseve
keywords.The ignore hints don't work with
@vitest/coverage-istanbul
since esbuild strips the comments before code is instrumented. Istanbul uses ignore hints to check whether coverage counters should be placed in given code block.With
@vitest/coverage-c8
the coverage filtering is done after the coverage report has been collected. The exclusion is done by comparing results to the actual sources where original comments are in place.v8-to-istanbul
used byc8
uses ignore hints to see whether uncovered lines should be marked as covered.