forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcode-coverage-exclude_spec.ts
More file actions
51 lines (45 loc) · 1.51 KB
/
Copy pathcode-coverage-exclude_spec.ts
File metadata and controls
51 lines (45 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* @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 {
BASE_OPTIONS,
describeBuilder,
UNIT_TEST_BUILDER_INFO,
setupApplicationTarget,
} from '../setup';
describeBuilder(execute, UNIT_TEST_BUILDER_INFO, (harness) => {
xdescribe('Option: "codeCoverageExclude"', () => {
beforeEach(async () => {
setupApplicationTarget(harness);
await harness.writeFiles({
'src/app/error.ts': `export const a = 1;`,
});
});
it('should not exclude any files from coverage when not provided', async () => {
harness.useTarget('test', {
...BASE_OPTIONS,
codeCoverage: true,
});
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();
const summary = harness.readFile('coverage/coverage-summary.json');
expect(summary).toContain('"src/app/error.ts"');
});
it('should exclude files from coverage that match the glob pattern', async () => {
harness.useTarget('test', {
...BASE_OPTIONS,
codeCoverage: true,
codeCoverageExclude: ['**/error.ts'],
});
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();
const summary = harness.readFile('coverage/coverage-summary.json');
expect(summary).not.toContain('"src/app/error.ts"');
});
});
});