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.

…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 added the target: minor This PR is targeted for the next minor release label Jan 24, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant