feat(@angular/build): add advanced coverage options to unit-test builder #31369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 concisecoverage
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 matchingcoverageInclude
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
andwatermarks
options, providing a better experience for users on that runner. Warnings remain for options that are still unsupported.