Replies: 5 comments 1 reply
-
did you get any answer ? @MenaiAla |
Beta Was this translation helpful? Give feedback.
-
I have a same question |
Beta Was this translation helpful? Give feedback.
-
Linking with upstream issue: cypress-io/code-coverage#583 |
Beta Was this translation helpful? Give feedback.
-
I used the swc-plugin. You can find the solution on Stackoverflow. |
Beta Was this translation helpful? Give feedback.
-
Using the solution pointed out by @alamenai didn't allow any build time or runtime server side code to have coverage collected. This impacts coverage collection from SSG and SSR scenarios while using the dev server or exporting to run coverage tests. I'm hoping that maybe I had just missed some configuration but it seems that the experimental https://github.com/kwonoj/swc-plugin-coverage-instrument project may not be a silver bullet just yet from what I can tell. |
Beta Was this translation helpful? Give feedback.
-
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Font optimization (next/font), SWC transpilation
Link to the code that reproduces this issue or a replay of the bug
.
To Reproduce
I integrated Cypress into my project for testing, and everything went well, however, when I want to make code coverage I could not find a solution for my issue.
In NextJS 13, it does not support
.babelrc
but SWC, however Istanbul requires.babelrc
as configuration!Please read this GitHub discussion
If I configure
.babelrc
and run my cypress and build scripts:They work well.
However, when I run
npm run dev
:I got an error:
for the build script I used the solution but I see it as a tricky solution.
2 Alternative
If I change the
.babelrc.js
to.babelrc.build.js
, thenpm run dev
works well because it ignore the babel file but the cypress failed:npm run cypress-run-component
Please, how to make code coverage in NextJS 13 with Cypress?
cypress.config.ts
next.config.ts
Describe the Bug
.
Expected Behavior
.
Which browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
Beta Was this translation helpful? Give feedback.
All reactions