-
Notifications
You must be signed in to change notification settings - Fork 450
Description
Description
The list of files excluded from code coverage is manually defined in excludeFromCoverage and then injected into babel-plugin-istanbul.
This creates a risk of configuration drift if the same exclusions are also defined elsewhere (eg. in Vitest config), leading to inconsistent or misleading coverage reports.
Code concerned
export const excludeFromCoverage = [
'/node_modules/',
'/test//.js',
'/tests//.js',
'/test-util/',
'/index.{ts,tsx}',
'/login-forms.tsx',
'**/group-forms.tsx',
];
plugins: [
[
'babel-plugin-istanbul',
{
...vitestCoverageOptions,
exclude: excludeFromCoverage,
},
],
],
Problems
Coverage exclusion rules may be duplicated in multiple places
Easy for exclusions to get out of sync
Harder to maintain and reason about coverage accuracy
Contributors may update one config but forget the other
Expected Behavior
Coverage exclusions should be defined in one canonical place
Build and test tooling should reuse the same configuration
Suggested Fix
Export coverage exclusions from a shared config module
Or rely solely on vitestCoverageOptions and avoid redefining exclusions
{
...vitestCoverageOptions,
}
Impact
More accurate and predictable coverage reports
Reduced maintenance overhead
Cleaner build/test configuration
Better developer experience