How to exclude some files and folders from coverage report?
See original GitHub issueI am trying to exclude some JS files from coverage report. I have already added this to package.json
"jest": {
"testPathIgnorePatterns" : ["<rootDir>/node_modules/", "<rootDir>/path/to/dir/" ],
"testResultsProcessor": "./node_modules/jest-junit-reporter"
}
Unfortunately files from those dir still appear when I run CI=true npm test -- --coverage
Issue Analytics
- State:
- Created 7 years ago
- Reactions:21
- Comments:34 (12 by maintainers)
Top Results From Across the Web
Is it possible exclude test directories from coverage.py reports?
Create .coveragerc file in your project root folder, and include the following: ... [run] omit = # ignore all test cases in tests/...
Read more >How to exclude some files and folders from coverage report in ...
In this simple tutorial, we are going to look at how to ignore or exclude some files or folders when testing in React...
Read more >Excluding code from coverage.py - Read the Docs
Coverage.py identifies exclusions by matching lines against a list of regular expressions. Using configuration files or the coverage API, you can add to...
Read more >How to exclude the file from a coverage report - FAQ - Aldec, Inc
In order to exclude a file from the coverage report, the -cc_exclude switch should be used with the asim command. ... We use...
Read more >How to Use a File to Exclude Files From Code Coverage
You can set coverage exclusions in the SonarCloud UI. · You can also add sonar.coverage.exclusions as an analysis parameter added to your scanner ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is commonly requested & we should support this.
OK, I needed to ignore all
*.stories.js
files and you can do this by overriding the value for the JestcollectCoverageFrom
option, which can be passed on the command-line via a customnpm test
command. Note thatcollectCoverageFrom
expects an array so to pass multiple values you specify the option multiple times.For example:
Notice the exclamation point (can I still call it a pling or does that betray my age?) to exclude a pattern.