Skip to content

Commit 8324a47

Browse files
committed
test(@angular/build): enable unit-test builder coverage tests
The tests for the the `codeCoverage`, `codeCoverageExclude`, and `codeCoverageReporters` options have now been enabled.
1 parent 344306c commit 8324a47

File tree

6 files changed

+86
-7
lines changed

6 files changed

+86
-7
lines changed

modules/testing/builder/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ts_project(
2121
# resolvable in the test project.
2222
":node_modules/@angular/ssr",
2323
":node_modules/vitest",
24+
":node_modules/@vitest/coverage-v8",
2425
] + glob(["projects/**/*"]),
2526
deps = [
2627
":node_modules/@angular-devkit/architect",

modules/testing/builder/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"@angular-devkit/architect": "workspace:*",
55
"@angular/ssr": "workspace:*",
66
"@angular-devkit/build-angular": "workspace:*",
7+
"@vitest/coverage-v8": "3.2.4",
78
"rxjs": "7.8.2",
89
"vitest": "3.2.4"
910
}

packages/angular/build/src/builders/unit-test/tests/options/code-coverage-exclude_spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '../setup';
1616

1717
describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
18-
xdescribe('Option: "codeCoverageExclude"', () => {
18+
describe('Option: "codeCoverageExclude"', () => {
1919
beforeEach(async () => {
2020
setupApplicationTarget(harness);
2121
await harness.writeFiles({
@@ -31,8 +31,8 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
3131

3232
const { result } = await harness.executeOnce();
3333
expect(result?.success).toBeTrue();
34-
const summary = harness.readFile('coverage/coverage-summary.json');
35-
expect(summary).toContain('"src/app/error.ts"');
34+
const summary = harness.readFile('coverage/coverage-final.json');
35+
expect(summary).toContain('src/app/error.ts"');
3636
});
3737

3838
it('should exclude files from coverage that match the glob pattern', async () => {
@@ -44,8 +44,8 @@ describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
4444

4545
const { result } = await harness.executeOnce();
4646
expect(result?.success).toBeTrue();
47-
const summary = harness.readFile('coverage/coverage-summary.json');
48-
expect(summary).not.toContain('"src/app/error.ts"');
47+
const summary = harness.readFile('coverage/coverage-final.json');
48+
expect(summary).not.toContain('src/app/error.ts"');
4949
});
5050
});
5151
});

packages/angular/build/src/builders/unit-test/tests/options/code-coverage-reporters_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '../setup';
1616

1717
describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
18-
xdescribe('Option: "codeCoverageReporters"', () => {
18+
describe('Option: "codeCoverageReporters"', () => {
1919
beforeEach(async () => {
2020
setupApplicationTarget(harness);
2121
});

packages/angular/build/src/builders/unit-test/tests/options/code-coverage_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '../setup';
1616

1717
describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
18-
xdescribe('Option: "codeCoverage"', () => {
18+
describe('Option: "codeCoverage"', () => {
1919
beforeEach(async () => {
2020
setupApplicationTarget(harness);
2121
});

pnpm-lock.yaml

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)