Reputation: 3081
Have used jest --config /path/jest-e2.json --coverage
But it's not generating any files only blank index file. Though test are running. I want to have a report of e2e test.
e2e setting
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage/e2e",
"coverageReporters" : ["json", "lcov", "text", "clover"],
"coveragePathIgnorePatterns": [
".module.ts$",
".spec.ts$"
]
}
Upvotes: 1
Views: 2017
Reputation: 70111
I had a similar issue generating coverage for my Ogma integration tests, it seems Jest won't collect coverage from outside the rootDir
. To fix this, I set my rootDir
as my project root (made the jest-integration.config.js
on the same level as package.json
) and told it to only collect coverage from src/**/*.ts
while ignoring *.spec.ts
files. Fixed the issue for me (it's a monorepo so the collectCoverageFrom
structure is slightly different, but the idea is the same)
Upvotes: 1