Skip to content
Open
Show file tree
Hide file tree
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
23 changes: 22 additions & 1 deletion testing/test-setup-config/src/lib/vitest-config-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,28 @@ function buildCoverageConfig(
return undefined;
}

const exclude = ['mocks/**', '**/types.ts', 'perf/**'];
const exclude = [
'mocks/**',
'perf/**',
Comment on lines +35 to +36
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'mocks/**',
'perf/**',
'mocks/**',
'tests/**',
'perf/**',

As our e2e tests all are placed in tests folders.

// Vitest configuration files
'**/vitest.*.config.ts',
'**/vitest.config.ts',
// code-pushup config
'**/code-pushup.config.ts',
// other config files
'**/*.config.ts',
// Barrel files (index files that only re-export)
'**/index.ts',
'**/index.js',
'**/index.mjs',
// Model files
'**/models.ts',
'**/*.model.ts',
'**/types.ts',
'**/*.types.ts',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a naming convention like we do have with *.mock.ts in tests.
ATM in our. repo there are *.types.ts and *.type.ts and types.ts.
We could agree on having only *.type.ts and types.ts and standardise the repo.

// typings
'**/*.d.ts',
];
const reportsDirectory = `../../coverage/${projectKey}/${kind}-tests`;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ describe('createVitestConfig', () => {
coverage: expect.objectContaining({
reporter: ['text', 'lcov'],
reportsDirectory: '../../coverage/test-package/unit-tests',
exclude: ['mocks/**', '**/types.ts', 'perf/**'],
exclude: [
'mocks/**',
'perf/**',
'**/vitest.*.config.ts',
'**/vitest.config.ts',
'**/code-pushup.config.ts',
'**/*.config.ts',
'**/index.ts',
'**/index.js',
'**/index.mjs',
'**/models.ts',
'**/*.model.ts',
'**/types.ts',
'**/*.types.ts',
'**/*.d.ts',
],
}),
typecheck: { include: ['**/*.type.test.ts'] },
}),
Expand Down Expand Up @@ -271,8 +286,19 @@ describe('createVitestConfig', () => {

expect(config.test!.coverage!.exclude).toEqual([
'mocks/**',
'**/types.ts',
'perf/**',
'**/vitest.*.config.ts',
'**/vitest.config.ts',
'**/code-pushup.config.ts',
'**/*.config.ts',
'**/index.ts',
'**/index.js',
'**/index.mjs',
'**/models.ts',
'**/*.model.ts',
'**/types.ts',
'**/*.types.ts',
'**/*.d.ts',
]);
});
});
Expand Down