Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Jan 24, 2026

This commit optimizes the Vitest test runner by removing the secondary import wrapper for test entry points when code coverage is not enabled. The wrapper is only necessary to support coverage exclusion of the test files themselves.

By capturing the resolved Vitest configuration within the configureVitest hook, the plugin can now determine if coverage is enabled and conditionally apply the wrapper. This simplifies the module graph for standard test runs.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Jan 24, 2026
…less coverage is enabled

This commit optimizes the Vitest test runner by removing the secondary import wrapper
for test entry points when code coverage is not enabled. The wrapper is only necessary
to support coverage exclusion of the test files themselves.

By capturing the resolved Vitest configuration within the `configureVitest` hook,
the plugin can now determine if coverage is enabled and conditionally apply the
wrapper. This simplifies the module graph for standard test runs.
@clydin clydin force-pushed the vitest/coverage-proxy-only branch from fb5e52e to 5c4cd1f Compare January 26, 2026 21:35
…bypassed

When code coverage is disabled, the Vitest builder bypasses the secondary import wrapper
and serves the compiled output directly as the test file. This caused sourcemaps to be
incorrect because the `sources` field in the map (relative to the build root) was being
resolved relative to the test file's location.

This commit adjusts the `sources` in the sourcemap to be relative to the test file's
directory, ensuring correct source mapping in debuggers.
@clydin clydin force-pushed the vitest/coverage-proxy-only branch from 5c4cd1f to 318dd47 Compare January 26, 2026 21:56
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 26, 2026
@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 Jan 27, 2026
@alan-agius4 alan-agius4 merged commit 0b49827 into angular:main Jan 27, 2026
36 checks passed
@alan-agius4
Copy link
Collaborator

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

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: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants