Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 17, 2025

Addresses an issue where user-defined coverageInclude patterns in Vitest could incorrectly exclude bundled virtual files during the pre-sourcemap coverage check, leading to incomplete or empty coverage reports.

This change modifies the generateCoverageOption function to augment user-provided coverageInclude arrays with specific globs (spec-*.js, chunk-*.js) that match the internal bundled test entry points and code chunks. This ensures that all necessary files are considered during Vitest's initial coverage pass, while still respecting the user's original include patterns for the post-sourcemap remapping.

Closes #31828

…tual files

Addresses an issue where user-defined `coverageInclude` patterns in Vitest
could incorrectly exclude bundled virtual files during the pre-sourcemap
coverage check, leading to incomplete or empty coverage reports.

This change modifies the `generateCoverageOption` function to augment
user-provided `coverageInclude` arrays with specific globs (`spec-*.js`,
`chunk-*.js`) that match the internal bundled test entry points and code
chunks. This ensures that all necessary files are considered during Vitest's
initial coverage pass, while still respecting the user's original `include`
patterns for the post-sourcemap remapping.
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 17, 2025
@clydin clydin requested a review from alan-agius4 November 17, 2025 00:31
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Nov 17, 2025
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 17, 2025
@clydin clydin merged commit 14cd1e1 into angular:main Nov 17, 2025
35 checks passed
@clydin
Copy link
Member Author

clydin commented Nov 17, 2025

This PR was merged into the repository. The changes were merged into the following branches:

@clydin clydin deleted the unit-test/correct-coverage-include branch November 17, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vitest unit test coverageInclude option is not working

2 participants