In my Jest tested project I have *.entity.ts
files. I don't want these files to be included in my coverage test.
According to the documentation at https://facebook.github.io/jest/docs/en/configuration.html#coveragepathignorepatterns-array-string there is a coveragePathIgnorePatterns
setting which you can use in the package.json
I've tried regex and file patterns but none of these just ignores the *.entity.ts
files in the final report.
When I add for example "coveragePathIgnorePatterns": ["common"]
my tests won't even run anymore.
Any thoughts on how I can make Jest skip the *.entity.ts
in the coverage tests?
My Jest section in the package.json looks like:
{
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage"
}
See Question&Answers more detail:os