Skip to content

Commit bd747d0

Browse files
author
Szymon.Poltorak
committed
refactor: improve excluded coverage files list
1 parent fc0abc0 commit bd747d0

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

packages/utils/mocks/sink.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Sink } from '../src/lib/sink-source.types';
1+
import type { Sink } from '../src/lib/sink-source.type';
22

33
export class MockSink implements Sink<string, string> {
44
private writtenItems: string[] = [];

packages/utils/src/lib/performance-observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type PerformanceObserverEntryList,
66
performance,
77
} from 'node:perf_hooks';
8-
import type { Buffered, Encoder, Observer, Sink } from './sink-source.types.js';
8+
import type { Buffered, Encoder, Observer, Sink } from './sink-source.type';
99

1010
export const DEFAULT_FLUSH_THRESHOLD = 20;
1111

File renamed without changes.

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@ function buildCoverageConfig(
3232
}
3333

3434
const exclude = [
35-
'mocks/**',
35+
'tests/**',
3636
'perf/**',
37-
// Vitest configuration files
37+
// Mocks and fixtures
38+
'mocks/**',
39+
'**/fixtures/**',
40+
'**/*.mock.ts',
41+
'**/*.fixture.ts',
42+
// Config files
3843
'**/vitest.*.config.ts',
3944
'**/vitest.config.ts',
40-
// code-pushup config
4145
'**/code-pushup.config.ts',
42-
// other config files
4346
'**/*.config.ts',
4447
// Barrel files (index files that only re-export)
4548
'**/index.ts',
@@ -49,7 +52,9 @@ function buildCoverageConfig(
4952
'**/models.ts',
5053
'**/*.model.ts',
5154
'**/types.ts',
52-
'**/*.types.ts',
55+
'**/*.type.ts',
56+
// Constants
57+
'**/constants.ts',
5358
// typings
5459
'**/*.d.ts',
5560
];

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ describe('createVitestConfig', () => {
3939
reporter: ['text', 'lcov'],
4040
reportsDirectory: '../../coverage/test-package/unit-tests',
4141
exclude: [
42-
'mocks/**',
42+
'tests/**',
4343
'perf/**',
44+
'mocks/**',
45+
'**/fixtures/**',
46+
'**/*.mock.ts',
47+
'**/*.fixture.ts',
4448
'**/vitest.*.config.ts',
4549
'**/vitest.config.ts',
4650
'**/code-pushup.config.ts',
@@ -51,7 +55,8 @@ describe('createVitestConfig', () => {
5155
'**/models.ts',
5256
'**/*.model.ts',
5357
'**/types.ts',
54-
'**/*.types.ts',
58+
'**/*.type.ts',
59+
'**/constants.ts',
5560
'**/*.d.ts',
5661
],
5762
}),
@@ -285,8 +290,12 @@ describe('createVitestConfig', () => {
285290
const config = createVitestConfig('test-package', 'unit');
286291

287292
expect(config.test!.coverage!.exclude).toEqual([
288-
'mocks/**',
293+
'tests/**',
289294
'perf/**',
295+
'mocks/**',
296+
'**/fixtures/**',
297+
'**/*.mock.ts',
298+
'**/*.fixture.ts',
290299
'**/vitest.*.config.ts',
291300
'**/vitest.config.ts',
292301
'**/code-pushup.config.ts',
@@ -297,7 +306,8 @@ describe('createVitestConfig', () => {
297306
'**/models.ts',
298307
'**/*.model.ts',
299308
'**/types.ts',
300-
'**/*.types.ts',
309+
'**/*.type.ts',
310+
'**/constants.ts',
301311
'**/*.d.ts',
302312
]);
303313
});

0 commit comments

Comments
 (0)