cypress-io / cypress-io/code-coverage

Code coverage e2e and unit test combining not working

Open
#265 5 comments 3 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**

first.spec.ts
![Screenshot 2020-06-20 at 23 44 58](https://user-images.githubusercontent.com/26057014/85212152-2f449200-b350-11ea-9df0-ed1d6110e6d4.png)

second.spec.ts
![Screenshot 2020-06-20 at 23 43 12](https://user-images.githubusercontent.com/26057014/85212159-3c618100-b350-11ea-84a9-c26856a5e2f9.png)

**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.8.1
- 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?
4.8.0
- What is your operating system?
macos
- What is the shell?
zsh
- What is the Node version?
10.17.0
- What is the NPM version?
6.11.3
- 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 CRA custom override
`webpackConfig.module.rules[2].oneOf[1].options.plugins.push('babel-plugin-istanbul')`
- 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?
![Screenshot 2020-06-20 at 23 51 37](https://user-images.githubusercontent.com/26057014/85212286-a75f8780-b351-11ea-8f97-02bf50f8115b.png)

- 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?
![Screenshot 2020-06-20 at 23 57 10](https://user-images.githubusercontent.com/26057014/85212311-e4c41500-b351-11ea-9564-ff86c449a6ca.png)

- 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 instrumented my code via the guide on the cypress site. coverage for the e2e tests are working but not for the separate unit tests as shown in the videos. it says it cannot find `__coverage__.`

i use typescript in my project and test files.

**Link to the repo**
Bugs with a reproducible example, like an open source repo showing the bug, are the most likely to be resolved.

**Example**
See [#217](https://github.com/cypress-io/code-coverage/issues/217) that is an excellent bug report example

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.