eXception
eXception

Reputation: 2301

Vitest: how to exclude directory from coverage report?

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?

Upvotes: 7

Views: 4646

Answers (1)

codereview
codereview

Reputation: 334

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.

Upvotes: 14

Related Questions