Cypress error: `cy.task('coverageReport')` failed - Cannot read properties of undefined (reading 'start')
marekdedic opened this issue · comments
Marek Dědič commented
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/</Runnable.prototype.run (http://localhost:8080/__cypress/runner/cypress_runner.js:107897:13)
at ../driver/src/cypress/runner.ts/create/onRunnableRun (http://localhost:8080/__cypress/runner/cypress_runner.js:164958:30)
at finallyHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:7872:23)
at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:11318:23)
at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromiseFromHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:9253:31)
at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise (http://localhost:8080/__cypress/runner/cypress_runner.js:9310:18)
at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise0 (http://localhost:8080/__cypress/runner/cypress_runner.js:9355:10)
at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromises (http://localhost:8080/__cypress/runner/cypress_runner.js:9435:18)
at _drainQueueStep (http://localhost:8080/__cypress/runner/cypress_runner.js:6025:12)
at _drainQueue (http://localhost:8080/__cypress/runner/cypress_runner.js:6018:24)
at ../../node_modules/bluebird/js/release/async.js/</Async.prototype._drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:6034:16)
at ../../node_modules/bluebird/js/release/async.js/</Async/this.drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:5904:14)
From Node.js Internals:
TypeError: Cannot read properties of undefined (reading 'start')
at <unknown> (/home/user/project/node_modules/istanbul-reports/lib/lcovonly/index.js:59:43)
at Array.forEach (<anonymous>)
at LcovOnlyReport.onDetail (/home/user/project/node_modules/istanbul-reports/lib/lcovonly/index.js:56:34)
at LcovReport.<computed> [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 <unknown> (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:92:19)
at Array.forEach (<anonymous>)
at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:91:28)
at <unknown> (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:92:19)
at Array.forEach (<anonymous>)
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 <unknown> (/home/user/project/node_modules/nyc/index.js:467:10)
at Array.forEach (<anonymous>)
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
:
{
"/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 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
marekdedic/imagelightbox@36513ec
Rohit Gohri commented
I'm having a similar issue, the problem is in the coverage output, it's invalid for some scenario. Example added below. The "s[29]" entry is null
and there is no corresponding statmentMap
entry for 29
{
"path": "/src/pages/index.tsx",
"statementMap": {
"0": {
"start": { "line": 31, "column": 69 },
"end": { "line": 198, "column": 1 }
},
"1": {
"start": { "line": 34, "column": 17 },
"end": { "line": 34, "column": 28 }
},
"2": {
"start": { "line": 35, "column": 16 },
"end": { "line": 35, "column": 32 }
},
"3": {
"start": { "line": 36, "column": 37 },
"end": { "line": 36, "column": 50 }
},
"4": {
"start": { "line": 37, "column": 44 },
"end": { "line": 37, "column": 59 }
},
"5": {
"start": { "line": 38, "column": 34 },
"end": { "line": 38, "column": 46 }
},
"6": {
"start": { "line": 40, "column": 30 },
"end": { "line": 45, "column": 4 }
},
"7": {
"start": { "line": 47, "column": 2 },
"end": { "line": 51, "column": 29 }
},
"8": {
"start": { "line": 48, "column": 4 },
"end": { "line": 50, "column": 5 }
},
"9": {
"start": { "line": 49, "column": 6 },
"end": { "line": 49, "column": 53 }
},
"10": {
"start": { "line": 54, "column": 32 },
"end": { "line": 54, "column": 38 }
},
"11": {
"start": { "line": 55, "column": 4 },
"end": { "line": 61, "column": 5 }
},
"12": {
"start": { "line": 56, "column": 6 },
"end": { "line": 59, "column": 9 }
},
"13": {
"start": { "line": 60, "column": 6 },
"end": { "line": 60, "column": 13 }
},
"14": {
"start": { "line": 62, "column": 4 },
"end": { "line": 75, "column": 5 }
},
"15": {
"start": { "line": 64, "column": 6 },
"end": { "line": 64, "column": 40 }
},
"16": {
"start": { "line": 65, "column": 6 },
"end": { "line": 68, "column": 9 }
},
"17": {
"start": { "line": 69, "column": 6 },
"end": { "line": 69, "column": 53 }
},
"18": {
"start": { "line": 71, "column": 6 },
"end": { "line": 74, "column": 9 }
},
"19": {
"start": { "line": 78, "column": 2 },
"end": { "line": 86, "column": 21 }
},
"20": {
"start": { "line": 79, "column": 34 },
"end": { "line": 79, "column": 46 }
},
"21": {
"start": { "line": 80, "column": 4 },
"end": { "line": 85, "column": 5 }
},
"22": {
"start": { "line": 81, "column": 6 },
"end": { "line": 84, "column": 9 }
},
"23": {
"start": { "line": 92, "column": 6 },
"end": { "line": 92, "column": 26 }
},
"24": {
"start": { "line": 94, "column": 2 },
"end": { "line": 197, "column": 4 }
},
"25": {
"start": { "line": 113, "column": 10 },
"end": { "line": 115, "column": 12 }
},
"26": {
"start": { "line": 191, "column": 10 },
"end": { "line": 191, "column": 33 }
},
"27": {
"start": { "line": 200, "column": 0 },
"end": { "line": 207, "column": 2 }
},
"28": {
"start": { "line": 201, "column": 2 },
"end": { "line": 206, "column": 4 }
}
},
"fnMap": {
"0": {
"name": "(anonymous_0)",
"decl": {
"start": { "line": 31, "column": 69 },
"end": { "line": 31, "column": 70 }
},
"loc": {
"start": { "line": 33, "column": 6 },
"end": { "line": 198, "column": 1 }
},
"line": 33
},
"1": {
"name": "(anonymous_1)",
"decl": {
"start": { "line": 47, "column": 12 },
"end": { "line": 47, "column": 13 }
},
"loc": {
"start": { "line": 47, "column": 18 },
"end": { "line": 51, "column": 3 }
},
"line": 47
},
"2": {
"name": "onSubmit",
"decl": {
"start": { "line": 53, "column": 17 },
"end": { "line": 53, "column": 25 }
},
"loc": {
"start": { "line": 53, "column": 60 },
"end": { "line": 76, "column": 3 }
},
"line": 53
},
"3": {
"name": "(anonymous_3)",
"decl": {
"start": { "line": 78, "column": 12 },
"end": { "line": 78, "column": 13 }
},
"loc": {
"start": { "line": 78, "column": 18 },
"end": { "line": 86, "column": 3 }
},
"line": 78
},
"4": {
"name": "(anonymous_4)",
"decl": {
"start": { "line": 111, "column": 17 },
"end": { "line": 111, "column": 18 }
},
"loc": {
"start": { "line": 111, "column": 23 },
"end": { "line": 116, "column": 9 }
},
"line": 111
},
"5": {
"name": "(anonymous_5)",
"decl": {
"start": { "line": 190, "column": 17 },
"end": { "line": 190, "column": 18 }
},
"loc": {
"start": { "line": 190, "column": 23 },
"end": { "line": 192, "column": 9 }
},
"line": 190
},
"6": {
"name": "(anonymous_6)",
"decl": {
"start": { "line": 200, "column": 15 },
"end": { "line": 200, "column": 16 }
},
"loc": {
"start": { "line": 200, "column": 30 },
"end": { "line": 207, "column": 1 }
},
"line": 200
}
},
"branchMap": {
"0": {
"loc": {
"start": { "line": 48, "column": 4 },
"end": { "line": 50, "column": 5 }
},
"type": "if",
"locations": [
{
"start": { "line": 48, "column": 4 },
"end": { "line": 50, "column": 5 }
},
{
"start": { "line": 48, "column": 4 },
"end": { "line": 50, "column": 5 }
}
],
"line": 48
},
"1": {
"loc": {
"start": { "line": 55, "column": 4 },
"end": { "line": 61, "column": 5 }
},
"type": "if",
"locations": [
{
"start": { "line": 55, "column": 4 },
"end": { "line": 61, "column": 5 }
},
{
"start": { "line": 55, "column": 4 },
"end": { "line": 61, "column": 5 }
}
],
"line": 55
},
"2": {
"loc": {
"start": { "line": 55, "column": 8 },
"end": { "line": 55, "column": 27 }
},
"type": "binary-expr",
"locations": [
{
"start": { "line": 55, "column": 8 },
"end": { "line": 55, "column": 14 }
},
{
"start": { "line": 55, "column": 18 },
"end": { "line": 55, "column": 27 }
}
],
"line": 55
},
"3": {
"loc": {
"start": { "line": 80, "column": 4 },
"end": { "line": 85, "column": 5 }
},
"type": "if",
"locations": [
{
"start": { "line": 80, "column": 4 },
"end": { "line": 85, "column": 5 }
},
{
"start": { "line": 80, "column": 4 },
"end": { "line": 85, "column": 5 }
}
],
"line": 80
},
"4": {
"loc": {
"start": { "line": 102, "column": 7 },
"end": { "line": 106, "column": 14 }
},
"type": "cond-expr",
"locations": [
{
"start": { "line": 103, "column": 8 },
"end": { "line": 105, "column": 16 }
},
{
"start": { "line": 106, "column": 10 },
"end": { "line": 106, "column": 14 }
}
],
"line": 102
},
"5": {
"loc": {
"start": { "line": 114, "column": 35 },
"end": { "line": 114, "column": 49 }
},
"type": "binary-expr",
"locations": [
{
"start": { "line": 114, "column": 35 },
"end": { "line": 114, "column": 43 }
},
{
"start": { "line": 114, "column": 47 },
"end": { "line": 114, "column": 49 }
}
],
"line": 114
},
"6": {
"loc": {
"start": { "line": 114, "column": 58 },
"end": { "line": 114, "column": 68 }
},
"type": "binary-expr",
"locations": [
{
"start": { "line": 114, "column": 58 },
"end": { "line": 114, "column": 62 }
},
{
"start": { "line": 114, "column": 66 },
"end": { "line": 114, "column": 68 }
}
],
"line": 114
},
"7": {
"loc": {
"start": { "line": 128, "column": 9 },
"end": { "line": 132, "column": 16 }
},
"type": "cond-expr",
"locations": [
{
"start": { "line": 129, "column": 10 },
"end": { "line": 131, "column": 18 }
},
{
"start": { "line": 132, "column": 12 },
"end": { "line": 132, "column": 16 }
}
],
"line": 128
}
},
"s": {
"0": 8,
"1": 44,
"2": 44,
"3": 44,
"4": 44,
"5": 44,
"6": 44,
"7": 44,
"8": 7,
"9": 0,
"10": 3,
"11": 3,
"12": 0,
"13": 0,
"14": 3,
"15": 3,
"16": 3,
"17": 0,
"18": 3,
"19": 44,
"20": 7,
"21": 7,
"22": 0,
"23": 44,
"24": 44,
"25": 0,
"26": 7,
"27": 8,
"28": 23,
"29": null
},
"f": { "0": 44, "1": 7, "2": 3, "3": 7, "4": 0, "5": 7, "6": 23 },
"b": {
"0": [0, 7],
"1": [0, 3],
"2": [3, 3],
"3": [0, 7],
"4": [0, 44],
"5": [0, 0],
"6": [0, 0],
"7": [6, 38]
},
"_coverageSchema": "43e27e138ebf9cfc5966b082cf9a028302ed4184",
"hash": "26bfa6610a0e31dccea4f3beff3f08eaf5aaf644"
}
]
Marek Dědič commented
Hi,
I don't have any null
s in my output, but it may be invalid in some other way...