No way to ignore directory in "coveragePathIgnorePatterns"

See original GitHub issue

Do you want to request a feature or report a bug? Bug

What is the current behavior? When running Jest code coverage test, I’m unable to ignore a complete folder in “coveragePathIgnorePatterns”.

"jest": {
    "collectCoverage": true,
    "coverageDirectory": "coverage/",
    "collectCoverageFrom": [
      "app/**/*.js"
    ],
    "coveragePathIgnorePatterns": [
      "app/index.js",
      "app/modules/**/*.js"
    ]
  }, 

As shown above app/modules/**/*.js isn’t supported by Jest.

What is the expected behavior? It should be possible to ignore one or many folders in the code coverage test.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system. Jest: v20.0.4 Node: v8.4.0 Yarn: 1.0.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

14reactions
mlpereiracommented, Jan 9, 2018

@dougbacelar I think what you want is “testPathIgnorePatterns” instead of “coveragePathIgnorePatterns”

12reactions
dougbacelarcommented, Jan 10, 2018

@mlpereira

think testPathIgnorePatterns is to prevent tests from being ran, while i really only want to ignore files such as setupTests.js from appearing on the coverage report.

I also tried collectCoverageFrom with no luck.

I think those properties are being overridden somehow somewhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I ignore a file pattern for Jest code coverage?
I use an external JSON file to hold my Jest configuration and run it from my package.json using npm: jest --config jest.config.json --no- ......
Read more >
Configuring Jest
The directory where Jest should output its coverage files. coveragePathIgnorePatterns [array<string>]​. Default: ["/node_modules/"]. An array of regexp pattern ...
Read more >
Jest ignore or exclude file/function/statement from test coverage
This post goes through how to ignore files, functions, lines and statements from coverage in Jest using configuration or istanbul pragmas.
Read more >
Configuring package.json · Jest
The directory where Jest should output its coverage files. coveragePathIgnorePatterns [array<string>] #. Default: ["/node_modules/"]. An array of regexp pattern ...
Read more >
Jest setup | React Made Native Easy
For all those who have not heard about Jest, have a quick look here: ... coveragePathIgnorePatterns : Defines the files which we want...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found