Open Thomasan1999 opened 4 days ago
By default only a list of config files are excluded from coverage: https://github.com/vitest-dev/vitest/blob/5932a7f988fdb269ac1ae704172bc7cfbf6ed721/packages/vitest/src/defaults.ts#L18
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'
.
Clear and concise description of the problem
By default only a list of config files are excluded from coverage: https://github.com/vitest-dev/vitest/blob/5932a7f988fdb269ac1ae704172bc7cfbf6ed721/packages/vitest/src/defaults.ts#L18
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
andtailwind.config.ts
files.Suggested solution
I would change the mentioned line to this:
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
andpostcss
to the list, this would resolve my use-case but not the problem in general. The code would look like this:Additional context
No response
Validations