istanbul icon indicating copy to clipboard operation
istanbul copied to clipboard

TypeError: Cannot read property 'text' of undefined

Open andrewl-telnyx opened this issue 7 years ago • 4 comments

not entirely sure if this is an issue with istanbul directly or karma-coverage, but i think it's an istanbul thing:

04 10 2017 09:34:48.018:ERROR [coverage]: TypeError: Cannot read property 'text' of undefined
    at project/node_modules/istanbul/lib/report/html.js:288:53
    at Array.forEach (native)
    at annotateBranches (project/node_modules/istanbul/lib/report/html.js:255:30)
    at HtmlReport.writeDetailPage (project/node_modules/istanbul/lib/report/html.js:426:9)
    at project/node_modules/istanbul/lib/report/html.js:489:26
    at SyncFileWriter.writeFile (project/node_modules/istanbul/lib/util/file-writer.js:57:9)
    at FileWriter.writeFile (project/node_modules/istanbul/lib/util/file-writer.js:147:23)
    at project/node_modules/istanbul/lib/report/html.js:488:24
    at Array.forEach (native)
    at HtmlReport.writeFiles (project/node_modules/istanbul/lib/report/html.js:482:23)
    at project/node_modules/istanbul/lib/report/html.js:484:22
    at Array.forEach (native)
    at HtmlReport.writeFiles (project/node_modules/istanbul/lib/report/html.js:482:23)
    at HtmlReport.writeReport (project/node_modules/istanbul/lib/report/html.js:566:14)
    at writeReport (project/node_modules/karma-coverage/lib/reporter.js:68:16)
    at project/node_modules/karma-coverage/lib/reporter.js:296:11

the problem is:

text = structuredText[startLine].text;

i guess it assumes structuredText[startLine] is always going to be a thing, and apparently at least once it is not a thing? I don't know how i can reproduce it but it appears every time we run karma with the coverage reporter. I created this issue with them. let me know what else i can provide to help y'all see the problem

andrewl-telnyx avatar Oct 04 '17 15:10 andrewl-telnyx

I see they have separate branch that fixes this problem: https://github.com/gotwarlost/istanbul/commit/4a5e92c1261bd08ce5118d01c8a05ae54fc7458b Pretty old but not merged for some reason?

Xesenix avatar Jan 12 '18 02:01 Xesenix

There are 2 PR opened that fix the issue but this project doesn't seem to be maintained anymore.

ffesseler avatar Mar 01 '18 23:03 ffesseler

I have forked it and linking fork in my projects:

https://github.com/Xesenix/istanbul

and in projects:

npm i -D github:Xesenix/istanbul

Xesenix avatar Mar 03 '18 13:03 Xesenix

@gotwarlost

benedictchen avatar Jun 29 '18 19:06 benedictchen