vitest-dev / vitest

Next generation testing framework powered by Vite.
https://vitest.dev
MIT License
13.13k stars 1.18k forks source link

Add msw and Vitest globalSetup default/conventional paths to coverage exclude defaults #6947

Open astorije opened 1 day ago

astorije commented 1 day ago

Clear and concise description of the problem

It is not uncommon to use msw and Vitest/Jest together (for good reasons, Vitest and msw are both ❤️). Would you be open to excluding **/mockServiceWorker.js from the default coverage files?

Same question about: globalSetup: "./vitest.globalSetup.ts", would **/vitest.globalSetup.(c|m)[jt]s be a good default to include?

Suggested solution

I am happy to open a PR / PRs to add those if you think this is a reasonable addition.

Alternative

A the moment, we are excluding these with:

exclude: [
  ...coverageConfigDefaults.exclude,
  "public/mockServiceWorker.js",
  "vitest.globalSetup.ts",
],

which of course is absolutely fine, but I wanted to check with y'all if this is something that would be beneficial to the community :)

Additional context

No response

Validations