I have written E2E tests using Jest, Puppeteer, and ReactJS for a Chrome extension. And I am not getting how can I generate its coverage report. Nothing seems to be working.
I tried generating coverage reports with the jest-puppeteer-istanbul
package with no jest-puppeteer
and using ts-jest
as preset in the Jest config.
// package.json
{
...
"scripts": {
...
"test:e2e": "NODE_OPTIONS=\"--max_old_space_size=4096\" yarn jest --runInBand --detectOpenHandles e2e-tests",
"test": "yarn test:e2e"
},
"jest": {
"preset": "ts-jest",
"testTimeout": 90000,
"moduleDirectories": [
"node_modules",
"src"
],
"collectCoverage": true,
"collectCoverageFrom": [
"src/pages/**/*"
],
"reporters": [
"default",
"jest-puppeteer-istanbul/lib/reporter"
],
"setupFilesAfterEnv": [
"jest-puppeteer-istanbul/lib/setup"
],
"coverageDirectory": "coverage"
}
}