Skip to content

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

Open
@ghost

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: empty outputCypress generates empty output reports

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions