Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude all '*.config.*' files from coverage by default #6508

Closed
4 tasks done
Thomasan1999 opened this issue Sep 14, 2024 · 2 comments
Closed
4 tasks done

Exclude all '*.config.*' files from coverage by default #6508

Thomasan1999 opened this issue Sep 14, 2024 · 2 comments

Comments

@Thomasan1999
Copy link

Thomasan1999 commented Sep 14, 2024

Clear and concise description of the problem

By default only a list of config files are excluded from coverage:

'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',

This seems like an extra work to list all libraries which use configuration files and you still might miss some. In my case, the default config did not include postcss.config.js and tailwind.config.ts files.

Suggested solution

I would change the mentioned line to this:

'**/*.config.*'

It would be easier to maintain and I don't think that it happens usually that someone uses .config. in a file name for a file they want to test.

Alternative

Add tailwind and postcss to the list, this would resolve my use-case but not the problem in general. The code would look like this:

'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier,postcss,tailwind}.config.*'

Additional context

No response

Validations

@Thomasan1999 Thomasan1999 changed the title Exclude all 'config.*' files from coverage by default Exclude all '*.config.*' files from coverage by default Sep 14, 2024
@AriPerkkio
Copy link
Member

By default only a list of config files are excluded from coverage:

'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',

That's test file exclusions. I wonder why that's even needed - doesn't make sense to have test file extensions in configuration files. 🤔

This seems like an extra work to list all libraries which use configuration files and you still might miss some.

Yep I agree, but adding **/*.config.* could cause unexpected results. I don't think we should add pattern that's this wide.

Instead of defining your postcss.config.js and tailwind.config.ts files in coverage.exclusion, I would rather recommend to specify coverage.include so that your configuration files wouldn't match it, e.g. coverage.include: 'src'.

@AriPerkkio
Copy link
Member

Closing the issue as **/*.config.* is too wide pattern to be a default value.

@AriPerkkio AriPerkkio closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants