Skip to content

Commit 6d8c86a

Browse files
committed
fix(@angular/build): suggest the istanbul provider in the unit-test V8 browser coverage error
When code coverage uses the V8 provider with a non-Chromium browser, the unit-test builder told users to disable coverage or remove the browser. The error predates Istanbul coverage support in the Vitest runner, so it never mentioned the option that keeps both. Suggest the `istanbul` provider first. The browser coverage e2e test now asserts the new hint.
1 parent 193abc0 commit 6d8c86a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ function validateBrowserCoverage(
529529
`Code coverage is enabled, but the following configured browsers do not support the V8 coverage provider: ` +
530530
`${unsupportedBrowsers.join(', ')}. ` +
531531
`V8 coverage is only supported on Chromium-based browsers (e.g., Chrome, Chromium, Edge). ` +
532-
`Please disable coverage or remove the unsupported browsers.`,
532+
`Please use the "istanbul" coverage provider (requires "@vitest/coverage-istanbul"), ` +
533+
`remove the unsupported browsers, or disable coverage.`,
533534
);
534535
}
535536
}

‎tests/e2e/tests/vitest/browser-coverage-validation.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ export default async function (): Promise<void> {
6767
/Code coverage is enabled, but the following configured browsers do not support the V8 coverage provider: firefox/,
6868
'Expected validation error for unsupported browser with coverage (config name).',
6969
);
70+
assert.match(
71+
output2,
72+
/Please use the "istanbul" coverage provider/,
73+
'Expected the error to suggest the istanbul coverage provider.',
74+
);
7075

7176
// === Case 3: Browser configured via vitest.config.mts (instances) ===
7277
await writeFile(

0 commit comments

Comments
 (0)