cypress-io / cypress-io/code-coverage

nyc_output folder not generated during automated build

Open
#522 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
445
Forks
115
PR merge metrics
No merged PRs in 30d

Description

**Logs and screenshots**
Please provide debug logs by running Cypress from the terminal with `DEBUG=code-coverage` environment variable set, see the [Debugging](https://github.com/cypress-io/code-coverage#debugging) section of the README file.

**Versions**

- What is this plugin's version? If this is NOT the latest [released version](https://github.com/cypress-io/code-coverage/releases) can you try the latest version, please? "^3.9.11
- 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 Cypress version? ^6.0.0
- What is your operating system? Microsoft OS
- What is the shell? CMD
- What is the Node version? 16.3.0
- What is the NPM version? 7.15.1
- 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 need to do it yourself.
- With `@cypress/instrument-cra` and `"start:coverage": "nyc --silent node index"` (https://www.cypress.io/blog/2019/09/05/cypress-code-coverage-for-create-react-app-v3/)
- When running tests, if you open the web application in regular browser, and open DevTools, do you see `window.__coverage__` object? Can you paste a screenshot? Yes
- Is there `.nyc_output` folder? Is there `.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? Yes
- 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**
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](https://user-images.githubusercontent.com/20289967/141391153-336818b0-d7c3-4383-a4e5-7cbcff2188d8.png)

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 ](https://github.com/cypress-io/instrument-cra) work only for local environments? **How do I instrument the app with `npm run build`?**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.