Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in .nyc_output causing nyc annotator crash #1527

Open
keminming opened this issue Aug 23, 2023 · 1 comment
Open

Inconsistency in .nyc_output causing nyc annotator crash #1527

keminming opened this issue Aug 23, 2023 · 1 comment

Comments

@keminming
Copy link

keminming commented Aug 23, 2023

Hi, we've seen nyc annotator crash on undefined object:
Cannot read properties of undefined (reading 'start') TypeError: Cannot read properties of undefined (reading 'start') at /private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-reports/lib/html/annotator.js:51:31 at Array.forEach () at annotateStatements (/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-reports/lib/html/annotator.js:48:36) at annotateSourceCode (/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-reports/lib/html/annotator.js:235:9) at HtmlReport.onDetail (/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-reports/lib/html/index.js:409:33) at LcovReport. [as onDetail] (/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-reports/lib/lcov/index.js:28:23) at Visitor.value (/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-lib-report/lib/tree.js:38:38) at ReportNode.visit (/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-lib-report/lib/tree.js:88:21) at /private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/node_modules/istanbul-lib-report/lib/tree.js:92:19 at Array.forEach ()

That's because the size of the statementMap doesn't match the size of s for checkRetriable.ts:
"/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/packages/util/src/checkRetriable.ts": { "path": "/private/var/jenkins/workspace/dcxjs_kwang_dcx-9771/packages/util/src/checkRetriable.ts", "statementMap": { "0": { "start": { "line": 23, "column": 35 }, "end": { "line": 23, "column": 74 } }, "1": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 108 } }, "2": { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 108 } }, "3": { "start": { "line": 26, "column": 20 }, "end": { "line": 27, "column": 83 } }, "4": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 83 } }, "5": { "start": { "line": 33, "column": 4 }, "end": { "line": 35, "column": null } }, "6": { "start": { "line": 34, "column": 8 }, "end": { "line": 34, "column": 21 } }, "7": { "start": { "line": 37, "column": 4 }, "end": { "line": 39, "column": 42 } }, **"8": { "start": { "line": 38, "column": 41 }, "end": { "line": 38, "column": 71 } }** }, "fnMap": { "0": { "name": "(anonymous_0)", "decl": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 19 } }, "loc": { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 108 } } }, "1": { "name": "(anonymous_1)", "decl": { "start": { "line": 26, "column": 20 }, "end": { "line": 26, "column": 21 } }, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 83 } } }, "2": { "name": "checkRetriable", "decl": { "start": { "line": 29, "column": 16 }, "end": { "line": 29, "column": 30 } }, "loc": { "start": { "line": 31, "column": 75 }, "end": { "line": 40, "column": 1 } } }, "3": { "name": "(anonymous_3)", "decl": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 27 } }, "loc": { "start": { "line": 38, "column": 41 }, "end": { "line": 38, "column": 71 } } } }, "branchMap": { "0": { "loc": { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 76 } }, "type": "binary-expr", "locations": [ { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 76 } }, { "start": { "line": 25, "column": 80 }, "end": { "line": 25, "column": 108 } } ] }, "1": { "loc": { "start": { "line": 27, "column": 27 }, "end": { "line": 27, "column": 60 } }, "type": "cond-expr", "locations": [ { "start": { "line": 27, "column": 27 }, "end": { "line": 27, "column": 60 } }, { "start": { "line": 27, "column": 63 }, "end": { "line": 27, "column": 83 } } ] }, "2": { "loc": { "start": { "line": 31, "column": 56 }, "end": { "line": 31, "column": 75 } }, "type": "default-arg", "locations": [ { "start": { "line": 31, "column": 56 }, "end": { "line": 31, "column": 75 } } ] }, "3": { "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 35, "column": null } }, "type": "if", "locations": [ { "start": { "line": 33, "column": 4 }, "end": { "line": 35, "column": null } }, { "start": { "line": 33, "column": 4 }, "end": { "line": 35, "column": null } } ] }, "4": { "loc": { "start": { "line": 38, "column": 10 }, "end": { "line": 38, "column": 72 } }, "type": "cond-expr", "locations": [ { "start": { "line": 38, "column": 10 }, "end": { "line": 38, "column": 72 } }, { "start": { "line": 39, "column": 10 }, "end": { "line": 39, "column": 41 } } ] } }, "s": { "0": 7, "1": 7, "2": 0, "3": 7, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, **"9": null** }, "f": { "0": 0, "1": 0, "2": 0, "3": 0 }, "b": { "0": [ 0, 0 ], "1": [ 0, 0 ], "2": [ 0 ], "3": [ 0, 0 ], "4": [ 0, 0 ] } },

NOTE the value of last entry in s is null which is very abnormal.

Is there a way further tracking down the issue?

@steoj
Copy link

steoj commented Nov 8, 2023

I can reproduce this when trying to merge two reports into one (from jest & cypress) when the coverage reports have entries for the same file. Removing reference to files so that a file record only occurs in one of the reports, fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants