I started using Cypress for NextJS, I followed their documentation for integrating babel-plugin-istanbul for transpiling during the code coverage. However, I faced this issue:
If I use baberc for configuring the plugin the test works well but the build fails because NextJS tells you that you disabled the SWC configuration ( default config instead of babel )
if I remove babelrc the build runs succeefully but the tests report the missing of babelrc configuration.
I found the same issue here but without an answer.
I configured my .babelrc for Cypress and Istanbul:
I started using Cypress for NextJS, I followed their documentation for integrating
babel-plugin-istanbul
for transpiling during the code coverage. However, I faced this issue:If I use
baberc
for configuring the plugin the test works well but the build fails because NextJS tells you that you disabled the SWC configuration ( default config instead of babel )if I remove
babelrc
the build runs succeefully but the tests report the missing ofbabelrc
configuration.I found the same issue here but without an answer.
I configured my
.babelrc
for Cypress and Istanbul:.babelrc
however, when I run
npm run build
, I got this error due to the custom configuration:.cypress.config.ts
.nycrc
next.config.ts
How to configure the plugin in SWC?
Resources:
https://docs.cypress.io/guides/tooling/code-coverage#Using-code-transpilation-pipeline