cypress-io / code-coverage

Saves the code coverage collected during Cypress tests
MIT License
433 stars 108 forks source link

nyc_output folder not generated during automated build #522

Open RichieRunner opened 2 years ago

RichieRunner commented 2 years ago

Logs and screenshots Please provide debug logs by running Cypress from the terminal with DEBUG=code-coverage environment variable set, see the Debugging section of the README file.

Versions

Describe the bug I'm running Cypress with the command DEBUG=code-coverage npx cypress run Cypress is able to generate .nyc_output locally, but not in automated build (Codebuild). Should the .nyc_output always be generated by Cypress on every cypress run?

image

I've recently discovered that my app built out to a server is NOT showing code coverage instrumentation in window.__coverage. Does this CRA instrumentation package work only for local environments? How do I instrument the app with npm run build?

RichieRunner commented 2 years ago

My research has led me to understand that I should be instrumenting code coverage through build, but I've now stumbled onto a new issue, which is this one

ngokevin commented 2 years ago

The issue for me was during production build mode, I had to force my plugin to do instrumentation (vite-plugin-istanbul + forceBuildInstrumentation option).