cypress-io / cypress-io/code-coverage

cypress-coverage/coverage-final.json is empty object when running cypress-and-jest

Open
#196 32 comments 0 reactions 0 assignees View on GitHub
topic: empty output
Dominant language
TypeScript
Stars
445
Forks
115
PR merge metrics
No merged PRs in 30d

Description

I'm following Gleb Bahmutov's instructions for getting combined code coverage reports from cypress and jest (https://github.com/bahmutov/cypress-and-jest), and ran into this issue. Gleb asked me to post the issue here.

When I run "npm t" on my own project, my jest tests display an accurate coverage report, the cypress tests all properly pass, and .nyc-output/out.json file contains a lot of entries for my source files.

However, cypress-coverage/coverage-final.json only contains "{}".

Two things I'm doing a bit differently that I think might have an effect:

(1) I already had cypress running so I did not run "npx @bahmutov/cly init". However, I did check the contents of Gleb's cypress/(plugins|support)/index.js, jest.config.js and package.json to make sure I got everything from them. In package.json, I have these slightly-different versions:

"@cypress/code-coverage": "^3.2.1",
"babel-plugin-istanbul": "^6.0.0",
"check-code-coverage": "^1.0.1",
"cypress": "^4.4.0",
"jest": "^25.3.0",

(2) Under my main project folder, I divided the code into two subfolders, each with its own package.json, because I want the tests to be in a separate subproject than the source (to make it easier to distribute the source without the tests):

project
├── source
│ ├── index.js
│ ├── lib/
│ ├── package.json
│ └── styles.css
└── tests
├── babel.config.js
├── coverage/
├── cypress/
├── cypress-coverage/
├── cypress.json
├── fdnCreate.html
├── fUpdate.html
├── jest.config.js
├── jest-coverage/
├── node_modules/
├── .nyc_output/
├── package.json
├── package-lock.json
├── reports/
└── _ _ tests_ _/

I'll greatly appreciate any suggestions!

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.