Skip to content

Commit fc0abc0

Browse files
author
Szymon.Poltorak
committed
refactor: remove noise files from test coverage
1 parent 7d3681c commit fc0abc0

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

testing/test-setup-config/src/lib/vitest-config-factory.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,28 @@ function buildCoverageConfig(
3131
return undefined;
3232
}
3333

34-
const exclude = ['mocks/**', '**/types.ts', 'perf/**'];
34+
const exclude = [
35+
'mocks/**',
36+
'perf/**',
37+
// Vitest configuration files
38+
'**/vitest.*.config.ts',
39+
'**/vitest.config.ts',
40+
// code-pushup config
41+
'**/code-pushup.config.ts',
42+
// other config files
43+
'**/*.config.ts',
44+
// Barrel files (index files that only re-export)
45+
'**/index.ts',
46+
'**/index.js',
47+
'**/index.mjs',
48+
// Model files
49+
'**/models.ts',
50+
'**/*.model.ts',
51+
'**/types.ts',
52+
'**/*.types.ts',
53+
// typings
54+
'**/*.d.ts',
55+
];
3556
const reportsDirectory = `../../coverage/${projectKey}/${kind}-tests`;
3657

3758
return {

testing/test-setup-config/src/lib/vitest-config-factory.unit.test.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,22 @@ describe('createVitestConfig', () => {
3838
coverage: expect.objectContaining({
3939
reporter: ['text', 'lcov'],
4040
reportsDirectory: '../../coverage/test-package/unit-tests',
41-
exclude: ['mocks/**', '**/types.ts', 'perf/**'],
41+
exclude: [
42+
'mocks/**',
43+
'perf/**',
44+
'**/vitest.*.config.ts',
45+
'**/vitest.config.ts',
46+
'**/code-pushup.config.ts',
47+
'**/*.config.ts',
48+
'**/index.ts',
49+
'**/index.js',
50+
'**/index.mjs',
51+
'**/models.ts',
52+
'**/*.model.ts',
53+
'**/types.ts',
54+
'**/*.types.ts',
55+
'**/*.d.ts',
56+
],
4257
}),
4358
typecheck: { include: ['**/*.type.test.ts'] },
4459
}),
@@ -271,8 +286,19 @@ describe('createVitestConfig', () => {
271286

272287
expect(config.test!.coverage!.exclude).toEqual([
273288
'mocks/**',
274-
'**/types.ts',
275289
'perf/**',
290+
'**/vitest.*.config.ts',
291+
'**/vitest.config.ts',
292+
'**/code-pushup.config.ts',
293+
'**/*.config.ts',
294+
'**/index.ts',
295+
'**/index.js',
296+
'**/index.mjs',
297+
'**/models.ts',
298+
'**/*.model.ts',
299+
'**/types.ts',
300+
'**/*.types.ts',
301+
'**/*.d.ts',
276302
]);
277303
});
278304
});

0 commit comments

Comments
 (0)