7

How to exclude a directory from coverage report in vitest?

I'm looking for something like coveragePathIgnorePatterns option as it was in jest:

coveragePathIgnorePatterns: [
    '<rootDir>/src/foo.ts',
    '<rootDir>/src/bar.ts',
     ....
  ],

How could I do that in vitest.config.ts?

1 Answer 1

15

inside coverage you need to add exclude ignore pattern. then it will work. like this:

in vite.config.ts

{
...
  test: {
     ...,
     coverage: {
       provider: 'istanbul',
       exclude: ['src/config/**']
     }

  }
}

Don't add it outside the coverage.didn't work for me.

Sign up to request clarification or add additional context in comments.

1 Comment

How can we do this via the CLI? if we need to see the coverage for a single file or folder for example?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.