Reputation: 4954
I need to merge Cypress coverage report and Jest coverage report, in the context of Next.js application.
Jest will list files as my-app/src/whatever
. Cypress only shows src/whatever
.
Cypress won't include my-app
and Jest does, which raises issue when trying to merge coverage using recommended method from Cypress examples. The alternative would be to have Cypress to display the folder too.
I'd like Jest to compute covered files path relative to the rootDir, without displaying it.
For example, the coverage report will show my-app/src/whatever
. It should only show src/whatever
, without my-app
.
Is that doable?
The alternative is to have Cypress considering another root dir, but I haven't found such options. It's the least promising option imo. Is there a relevant option for this?
Subsidiary question: both tools have a different line count, probably due to TypeScript + Babel + Webpack interactions with the code. How can I debug this issue?
Thanks
Edit for clarity
Upvotes: 5
Views: 1595
Reputation: 4954
As a quickfix specific to Next, using an src
folder is now doable in Next. So putting all testable code in an isolated folder can be a quickfix.
In your Jest config:
collectCoverageFrom: [
"src/**/*.{js,jsx,ts,tsx}"
...
(not sure why but Cypress do not seem to need aditional config when adding an src
folder)
Upvotes: 2