Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/

import { execute } from '../../index';
import { CoverageReporterEnum } from '../../schema';
import {
BASE_OPTIONS,
describeBuilder,
UNIT_TEST_BUILDER_INFO,
setupApplicationTarget,
} from '../setup';

describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
describe('Option: "coverageWatermarks"', () => {
beforeEach(async () => {
setupApplicationTarget(harness);
});

// Any coverage percentage is at or above a 0% high watermark and below a 101% low watermark.
for (const [watermark, level] of [
[[0, 0], 'high'],
[[101, 101], 'low'],
] as const) {
it(`should mark coverage as "${level}" in the HTML report with ${watermark} watermarks`, async () => {
harness.useTarget('test', {
...BASE_OPTIONS,
coverage: true,
coverageReporters: [CoverageReporterEnum.Html],
coverageWatermarks: {
statements: [...watermark],
branches: [...watermark],
functions: [...watermark],
lines: [...watermark],
},
});

const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();
harness.expectFile('coverage/test/index.html').content.toContain(`status-line ${level}`);
});
}
});
});
Loading