Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Coverage on Untested Files - Jest

When using @vue/cli-plugin-unit-jest, I am receiving coverage reports each time I run my unit tests, regardless of whether I have the --coverage flag in the execution line or not. I do not want to receive coverage reports on all of my untested files. When searching for an answer online, there are numerous questions about how to turn that feature on, not turn it off. I can't find it in the documentation either.

How do you disable the Coverage on Untested Files feature in Jest?

like image 583
Chasen Bettinger Avatar asked Feb 18 '19 16:02

Chasen Bettinger


2 Answers

Disabling coverage similar to enabling it, just prefix the pattern with an ! like so:

{
  "collectCoverageFrom": [
    "**/*.{js,jsx}",
    "!**/node_modules/**",
    "!**/folder-with-untested-files/**"
  ]
}

Or disable coverage all together with "collectCoverage": false. If that does not work, then you have this params overridden somewhere in your code.

like image 88
Herman Starikov Avatar answered Oct 17 '22 22:10

Herman Starikov


"collectCoverage": false

in jest.config.js

like image 8
Irteza Asad Avatar answered Oct 17 '22 23:10

Irteza Asad