Skip to content

Conversation

clydin
Copy link
Member

@clydin clydin commented Oct 2, 2025

The unit-test builder is enhanced with several new coverage features to provide a more robust and configurable testing experience.

This change refactors the existing codeCoverage options to a more concise coverage prefix for a cleaner API. Since the builder is experimental, this is the ideal time for such an improvement.

The following new options have been added:

  • coverageAll: Includes all files matching coverageInclude in the report, ensuring untested files are visible.
  • coverageInclude: Specifies which files to include in the report, providing more accurate metrics.
  • coverageThresholds: Allows setting minimum coverage percentages for statements, branches, functions, and lines. If thresholds are not met, the builder will exit with an error, enabling automated quality gates in CI.
  • coverageWatermarks: Allows customization of coverage watermarks for the HTML reporter.

The Karma runner has been updated to support the thresholds and watermarks options, providing a better experience for users on that runner. Warnings remain for options that are still unsupported.

@clydin clydin added the target: major This PR is targeted for the next major release label Oct 2, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/build labels Oct 2, 2025
The `unit-test` builder is enhanced with several new coverage features to provide a more robust and configurable testing experience.

This change refactors the existing `codeCoverage` options to a more concise `coverage` prefix for a cleaner API. Since the builder is experimental, this is the ideal time for such an improvement.

The following new options have been added:
- `coverageAll`: Includes all files matching `coverageInclude` in the report, ensuring untested files are visible.
- `coverageInclude`: Specifies which files to include in the report, providing more accurate metrics.
- `coverageThresholds`: Allows setting minimum coverage percentages for statements, branches, functions, and lines. If thresholds are not met, the builder will exit with an error, enabling automated quality gates in CI.
- `coverageWatermarks`: Allows customization of coverage watermarks for the HTML reporter.

The Karma runner has been updated to support the `thresholds` and `watermarks` options, providing a better experience for users on that runner. Warnings remain for options that are still unsupported.
@clydin clydin force-pushed the unit-test/coverage-options branch from 564c427 to 477aae8 Compare October 2, 2025 16:14
@clydin clydin marked this pull request as ready for review October 2, 2025 16:15
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Oct 2, 2025
@clydin clydin merged commit 3b7dabb into angular:main Oct 2, 2025
33 checks passed
@clydin clydin deleted the unit-test/coverage-options branch October 2, 2025 17:05
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 detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants