Skip to content

Commit 5111609

Browse files
committed
fix(@angular/build): favor istanbul coverage provider when browser testing is enabled
When browser testing is enabled (`browsers` option configured), using V8 coverage in Chromium requires fetching and remapping source maps over CDP/HTTP for every script loaded in the browser window, causing multi-minute delays during report generation on large projects. This change updates `determineCoverageProvider` to favor `@vitest/coverage-istanbul` when browser mode is active and `@vitest/coverage-istanbul` is installed in `node_modules`. Istanbul instruments code at build time, allowing instant coverage extraction from `window.__coverage__` without CDP sourcemap resolution overhead. Explicit `coverage.provider` settings in user configuration remain fully respected. Relates to #31724
1 parent 10dc30f commit 5111609

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • packages/angular/build/src/builders/unit-test/runners/vitest

packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ function determineCoverageProvider(
102102
const hasIstanbul = checkInstalled('@vitest/coverage-istanbul');
103103
const hasV8 = checkInstalled('@vitest/coverage-v8');
104104

105-
if (hasIstanbul && !hasV8) {
105+
// Favor istanbul when browser testing is enabled (to avoid slow CDP V8 HTTP sourcemap remapping)
106+
// or when only istanbul is installed.
107+
if (hasIstanbul && (browsersToCheck.length > 0 || !hasV8)) {
106108
determinedProvider = 'istanbul';
107109
} else {
108110
determinedProvider = 'v8';

0 commit comments

Comments
 (0)