Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hugodf/jest-ignore-coverage
Examples of how to ignore files/functions/statements for coverage
https://github.com/hugodf/jest-ignore-coverage
coverage coverage-testing jest nodejs-testing testing
Last synced: about 2 months ago
JSON representation
Examples of how to ignore files/functions/statements for coverage
- Host: GitHub
- URL: https://github.com/hugodf/jest-ignore-coverage
- Owner: HugoDF
- License: mit
- Created: 2019-06-09T21:40:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:46:10.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T12:11:49.323Z (2 months ago)
- Topics: coverage, coverage-testing, jest, nodejs-testing, testing
- Language: JavaScript
- Size: 267 KB
- Stars: 16
- Watchers: 2
- Forks: 3
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jest Ignore Coverage
To see all the following in action, run `yarn install` (or `npm install`) followed by `yarn test` (or `npx jest --coverage`) to collect coverage.
## Exclude file(s) from Jest coverage using configuration
See [./package.json](./package.json) `testPathIgnorePatterns`. It ignores the contents of `src/testignore`, which actually just contains a failing test in [./src/testignore/ignored-test.test.js](./src/testignore/ignored-test.test.js).
See [./package.json](./package.json) `collectCoverageFrom`. It does not collect coverage from [./src/config-ignore-me.js](./src/config-ignore-me.js).
## Exclude file from Jest coverage at the file level
See [./src/comment-ignored.js](./src/comment-ignored.js). It uses the comment notation to ignore the file.
## Exclude function or statement from Jest coverage
See [./src/snippet.js]. It showcases the `istanbul ignore next` and `istanbul ignore [type]` syntax (in this case `istanbul ignore else`).