cypress-io / cypress-io/code-coverage
Cypress error: `cy.task('coverageReport')` failed - Cannot read properties of undefined (reading 'start')
- Dominant language
- TypeScript
- Stars
- 445
- Forks
- 115
- PR merge metrics
- No merged PRs in 30d
Description
**Logs and screenshots**
Hi,
I get the following error in cypress (this is the output from "Print to console"):
```
CypressError: `cy.task('coverageReport')` failed with the following error:
> Cannot read properties of undefined (reading 'start')
Because this error occurred during a `after all` hook we are skipping all of the remaining tests.
at ../driver/src/cy/commands/task.ts/__webpack_exports__.default/task (http://localhost:8080/__cypress/runner/cypress_runner.js:145775:78)
From previous event:
at task (http://localhost:8080/__cypress/runner/cypress_runner.js:145757:10)
at ../driver/src/cypress/cy.ts/addCommand/wrap (http://localhost:8080/__cypress/runner/cypress_runner.js:157372:43)
From Your Spec Code:
at generateReport (webpack:///./node_modules/@cypress/code-coverage/support.js:200:0)
at ../driver/src/cypress/cy.ts/setRunnable/runnable.fn (http://localhost:8080/__cypress/runner/cypress_runner.js:157640:43)
at callFn (http://localhost:8080/__cypress/runner/cypress_runner.js:107910:21)
at ../driver/node_modules/mocha/lib/runnable.js/ (/home/user/project/node_modules/istanbul-reports/lib/lcovonly/index.js:59:43)
at Array.forEach ()
at LcovOnlyReport.onDetail (/home/user/project/node_modules/istanbul-reports/lib/lcovonly/index.js:56:34)
at LcovReport. [as onDetail] (/home/user/project/node_modules/istanbul-reports/lib/lcov/index.js:25:23)
at Visitor.value (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:38:38)
at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:88:21)
at (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:92:19)
at Array.forEach ()
at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:91:28)
at (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:92:19)
at Array.forEach ()
at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:91:28)
at ReportTree.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:127:24)
at LcovReport.execute (/home/user/project/node_modules/istanbul-lib-report/lib/report-base.js:12:44)
at (/home/user/project/node_modules/nyc/index.js:467:10)
at Array.forEach ()
at NYC.report (/home/user/project/node_modules/nyc/index.js:461:19) [index.ce8ed54d.js:99335:13](http://localhost:8080/__/assets/index.ce8ed54d.js)
```
**Versions**
- What is this plugin's version? `3.10.0`
- What is Cypress version? `10.10.0`
- What is your operating system? `Debian testing`
- What is the shell? `zsh`
- What is the Node version? `v18.11.0`
- What is the NPM version? `8.19.2`
- How do you instrument your application? gulp-istanbul
- When running tests, if you open the web application in regular browser, and open DevTools, do you see `window.__coverage__` object? 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?
There is, pasting `out.json`:
```json
{
"/home/user/project/src/file.js": {
"path": "/home/user/project",
"s": {
"1": 1,
"2": 1,
"3": 1
"...": "truncated"
}
}
}
```
- 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**
When running a spec file, I get the error reported above.
**Link to the repo**
https://github.com/marekdedic/imagelightbox/commit/36513ec34716c92046bec270979108b5e3a23111
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.