Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 19, 2025

This commit addresses an issue where Vitest coverage reports were incomplete on Windows when using the JSDOM test environment. The root cause is an improperly formatted absolute path that can result from manually converting a file URL back to a path on Windows, leading to a superfluous leading slash (e.g., '/D:/path' instead of 'D:/path'). The 'angular:test-in-memory-provider' plugin now explicitly detects and removes this leading slash from absolute Windows paths, thereby correcting the path format and enabling proper source file mapping for coverage collection.

Closes #31842

@clydin clydin added target: patch This PR is targeted for the next patch release and removed area: @angular/build labels Nov 19, 2025
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you open an upstream issue for this please?

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Nov 19, 2025
@ngbot

This comment was marked as outdated.

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker labels Nov 19, 2025
@ngbot

This comment was marked as outdated.

@dgp1130
Copy link
Collaborator

dgp1130 commented Nov 19, 2025

This is hitting a merge conflict now which will need to be addressed.

@dgp1130 dgp1130 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Nov 19, 2025
…M on Windows

This commit addresses an issue where Vitest coverage reports were incomplete on Windows when using the JSDOM test environment. The root cause is an improperly formatted absolute path that can result from manually converting a file URL back to a path on Windows, leading to a superfluous leading slash (e.g., '/D:/path' instead of 'D:/path').
The 'angular:test-in-memory-provider' plugin now explicitly detects and removes this leading slash from absolute Windows paths, thereby correcting the path format and enabling proper source file mapping for coverage collection.
@clydin clydin force-pushed the unit-test/windows-jsdom-coverage-fix branch from 02d78f7 to 3f0fd08 Compare November 19, 2025 22:21
@clydin clydin removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 19, 2025
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Nov 19, 2025
@clydin clydin merged commit 3020b50 into angular:main Nov 19, 2025
36 checks passed
@clydin
Copy link
Member Author

clydin commented Nov 19, 2025

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

@clydin clydin deleted the unit-test/windows-jsdom-coverage-fix branch November 19, 2025 23:22
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: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V8 coverage is 0% with jsdom environment on Windows

3 participants