Skip to content

[Question] How to configure filtering? #122

@EvgenyOrekhov

Description

@EvgenyOrekhov

Documentation for filtering is very confusing. I tried every possible combination of options, but I wasn't able to set up filtering the way I want.

What I want:

  1. Collect coverage for all *.ts and *.tsx files in my project's src/ folder (even for those files that weren't executed during a test run).
  2. Exclude files in __tests__ folders. I do not want test files to show up in the report.
  3. Exclude testData.ts, *.test.ts, and *.test.tsx files. I do not want test files to show up in the report.
  4. Exclude npm packages. I do not want third party files to show up in the report.

I tried every combination of all, filter, entryFilter, and sourceFilter options I could think of, but every time the result is unexpected.

I either get 0% coverage, or I get third party files in the report (like src/applyMiddleware.ts from Redux, or src/Components/Alert/Alert.tsx from a UI library).
And I just can't exclude test files like src/actions/main/__tests__/main.test.tsx.

I think this use case is very common, so it would be helpful for the community if you could provide an example configuration for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions