cypress-io / code-coverage

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

Code Coverage html report is empty #848

Open Isurunc opened 2 months ago

Isurunc commented 2 months 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.

Screenshot 2024-07-09 at 12 14 18

Versions

"dependencies": "cypress/instrument-cra": "1.4.0", "babel-plugin-istanbul": "6.1.1", "react": "18.2.0", "react-dom": "18.2.0",

"scripts": "start": "react-scripts -r @cypress/instrument-cra start", "build": "react-scripts build", "test": "react-scripts test cypress run", "eject": "react-scripts eject", "coverage:report": "nyc report --reporter=html --reporter=text-summary",


- If the plugin worked before in version X but stopped after upgrading to version Y, please try the [released versions](https://github.com/cypress-io/code-coverage/releases) between X and Y to see where the breaking change was.
- What is the Cypress version?
**Cypress package version: 13.6.6
Cypress binary version: 13.6.6
Electron version: 27.1.3**

- What is your operating system? **mac os**
- What is the shell? **Zsh**
- What is the Node version?
**Bundled Node version: 18.17.1**

- What is the NPM version?
**10.5.0**

- How do you instrument your application? Cypress [does not instrument web application code](https://github.com/cypress-io/code-coverage#instrument-your-application), so you must do it yourself. **https://istanbul.js.org/ instanbul tool latest**

- When running tests, if you open the web application in a regular browser and open DevTools, do you see `window.__coverage__` object? Can you paste a screenshot? Yes I can see it. 

- Is there a `.nyc_output` folder? Is there a `.nyc_output/out.json` file? Is it empty? Can you paste at least part of it so we can see the keys and file paths? **It's not empty**

- Do you have any custom NYC settings in `package.json` (`nyc` object) or in other [NYC config files](https://github.com/istanbuljs/nyc#configuration-files)? **No** 
- Do you run Cypress tests in a Docker container? **No** 

**Describe the bug**
NYC reports and counters are generated but the code coverage HTML file is empty. The window.__coverage__ object is present. 

<img width="1440" alt="Screenshot 2024-07-09 at 11 14 00" src="https://github.com/cypress-io/code-coverage/assets/20430640/32adcdec-7d74-44eb-8f6d-217c7b625bf3">

**Link to the repo**
(https://github.com/Isurunc/Cypress_CodeCoverage_ReactApp/tree/master)

my issue is similar to https://github.com/cypress-io/code-coverage/issues/227