Skip to content

feat(@angular/build): support Istanbul coverage in Vitest runner#33029

Open
clydin wants to merge 1 commit intoangular:mainfrom
clydin:feat/vitest-istanbul-coverage
Open

feat(@angular/build): support Istanbul coverage in Vitest runner#33029
clydin wants to merge 1 commit intoangular:mainfrom
clydin:feat/vitest-istanbul-coverage

Conversation

@clydin
Copy link
Copy Markdown
Member

@clydin clydin commented Apr 21, 2026

This change enables code coverage reporting when running tests in non-Chromium browsers (like Firefox or Safari) with the Vitest runner.

The system now automatically detects the best coverage provider based on the configured browsers and installed packages:

  • If non-Chromium browsers are configured, it selects 'istanbul'.
  • If only Chromium browsers are used, it selects 'istanbul' if it is the only provider package installed.
  • Otherwise, it defaults to 'v8'. It also respects the provider specified in the user's custom Vitest configuration.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Apr 21, 2026
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/build labels Apr 21, 2026
@clydin clydin force-pushed the feat/vitest-istanbul-coverage branch 5 times, most recently from f3443aa to 0b4f325 Compare April 22, 2026 01:05
@clydin clydin marked this pull request as ready for review April 22, 2026 01:05
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Apr 22, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for the Istanbul coverage provider in the Vitest unit test runner, including automatic provider detection based on the target browser and installed dependencies. The review feedback identifies an opportunity to optimize browser detection logic using '.some()' for better performance and highlights several logic issues in the 'getBrowsersToCheck' function regarding CLI option priority and the handling of the 'enabled' property.

Comment thread packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts Outdated
This change enables code coverage reporting when running tests in non-Chromium browsers (like Firefox or Safari) with the Vitest runner.

The system now automatically detects the best coverage provider based on the configured browsers and installed packages:
- If non-Chromium browsers are configured, it selects 'istanbul'.
- If only Chromium browsers are used, it selects 'istanbul' if it is the only provider package installed.
- Otherwise, it defaults to 'v8'.
It also respects the provider specified in the user's custom Vitest configuration.
@clydin clydin force-pushed the feat/vitest-istanbul-coverage branch from 0b4f325 to 58ce827 Compare April 22, 2026 14:06
@clydin clydin requested review from alan-agius4 April 22, 2026 14:43
@clydin clydin linked an issue Apr 22, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coverage only works with Chromium in vitest

1 participant