Not sure where to start with this one. Output works beautifully but the last lines are an error:
2 06 2017 11:52:50.122:ERROR [coverage]: TypeError: Cannot read property 'text' of undefined
at C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:210:45
at Array.forEach (native)
at annotateStatements (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:193:33)
at HtmlReport.writeDetailPage (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:428:9)
at C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:489:26
at SyncFileWriter.writeFile (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\util\file-writer.js:57:9)
at FileWriter.writeFile (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\util\file-writer.js:147:23)
at C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:488:24
at Array.forEach (native)
at HtmlReport.writeFiles (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:482:23)
at C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:484:22
at Array.forEach (native)
at HtmlReport.writeFiles (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:482:23)
at HtmlReport.writeReport (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\html.js:566:14)
at LcovReport.writeReport (C:\Users\brian.cullinan\Documents\portal\node_modules\istanbul\lib\report\lcov.js:55:19)
at writeReport (C:\Users\brian.cullinan\Documents\portal\node_modules\karma-coverage\lib\reporter.js:68:16)
I have the same problem, my repo is:
https://github.com/FezVrasta/popper.js/pull/314
To reproduce just run yarn test
I have the same issue. I did a bit of investigation and it seems to be at this point:
https://github.com/gotwarlost/istanbul/blob/master/lib/report/html.js#L288
At the point it errors on my project, structuredText is an array of 60 objects but startLine is 64, so it's returning undefined.
However the coverage report is generating correctly!
I put in a local hack to stop the error from showing: ... && (startLine <= structuredText.length) on the following lines:
https://github.com/gotwarlost/istanbul/blob/master/lib/report/html.js#L205
https://github.com/gotwarlost/istanbul/blob/master/lib/report/html.js#L236
https://github.com/gotwarlost/istanbul/blob/master/lib/report/html.js#L283
Not sure what's causing this issue though as I'm not too familiar with the Istanbul source, so would be good to get some suggestions on a fix to the underlying problem?
FYI: This issue started appearing when I updated our project to angular v4.x and angular-cli v1.1.2 with karma-coverage-istanbul-reporter v1.3.0
it is solved with: https://github.com/gotwarlost/istanbul/pull/819
This not "solved" until a fix is merged in and people stop getting poor
error messaging for framework bugs.
On Jun 22, 2017 3:55 AM, "Cenk Ebret" notifications@github.com wrote:
it is solved with: #819 https://github.com/gotwarlost/istanbul/pull/819
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/gotwarlost/istanbul/issues/817#issuecomment-310346550,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AX5XbpdFGqJUCtlFDwS5vjVrzHdo3WyRks5sGkgDgaJpZM4N3iuA
.
Hello. When it's going to be fixed? I cannot get proper html report
Congratulations!! You win 1000000000 points for arriving here at the same
conclusion as we did! Here is a joke while you wait for a response:
Q: Why was everyone so tired on April 1st? A: They had just finished a
March of 31 days.
On Wed, Nov 15, 2017 at 9:26 AM, Arsen Slyusarchuk <[email protected]
wrote:
Hello. When it's going to be fixed? I cannot get proper html report
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/gotwarlost/istanbul/issues/817#issuecomment-344647091,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AX5XbhyFdjDF1pBvphV_3bFvPB1jgNWjks5s2xCfgaJpZM4N3iuA
.
--
CONFIDENTIALITY NOTICE: The contents of this email message and any
attachments are intended solely for the addressee(s) and may contain
confidential and/or privileged information and may be legally protected
from disclosure. It is then shared with tech companies, bots, hackers,
government agencies, and marketers. The security of this message is none,
and it may be shared on Instagram at anytime. If you are OK with this,
please respond. There isn't really any security or privacy anywhere. If
you disagree you may want to go camping and talk to people face-to-face
like in old times.
No news ?
Dev's on holiday? How long is this going to take?
Reverting istanbul to 0.4.4 worked for me.
I am using gulp-istanbul 1.1.3 which depends on istanbul 0.4.x and I encountered this issue (when it was using istanbul 0.4.5). Manually forcing gulp-istanbul to use istanbul 0.4.4 resulted in the same error.
@heronblade Is it possible another change helped you fix this or was it just the downgrade?
Also, this issue seems to be stuck without any updates or progress. Is there anything users can provide to help the project maintainers root cause this? It seems related to source maps but my mocha test setup doesn't really do anything with source maps so I'm not sure where to try to fiddle with things to get around this error.
Reverting to istanbul 0.4.4 did not solve the issue for me, either.
Bump. So this issue is an unsolved blocker? Any other workaround suggestions. Istanbul seems like the only game in time for modern js coverage so I'm a bit lost where to go from here.
FWIW, I gave up using gulp to drive my mocha test run. When I instead invoked nyc via an npm script, it worked fine. I think that means using this package by itself is no longer supported.
Check out https://github.com/gotwarlost/istanbul/issues/602 for a resolution
I am using simple istanbul and still recieveing this error. Does anyone know how to solve it? It is generating lcov.info correctly but not index.html
FWIW I switched to using nyc via its CLI and it's working. I think this means this package is unmaintained/dead for other use cases.
In my case, i am using protractor + istanbul to get coverage for integration testing.
So need to pre-instrument source file before test and get this error in istanbule report.
I find if i use origin source file to replace the instrumented source file, then it works.
Checking code, structuredText[startLine].text is undefined due to the instrumented source file text structure is changed and the [startLine] line is invalid.
I've started seeing this issue a couple days ago. A week ago everything worked smoothly. Looks like our js source code was changed and somehow uncovered this bug.
"istanbul": "^0.4.5",
"istanbul-combine": "^0.3.0"
We are combining coverage from a set of files. Looks like calculation is fine, but the report generation is failed
=============================== Coverage summary ===============================
Statements : 29.37% ( 1614/5496 )
Branches : 9.96% ( 442/4436 )
Functions : 28.57% ( 932/3262 )
Lines : 30.26% ( 1276/4217 )
================================================================================
node_modules/istanbul-combine/node_modules/istanbul/lib/report/html.js:283
text = structuredText[startLine].text;
Another possible reason can be that we switched from angulajs-1.7.0 to angularjs-1.7.3 a month ago
fixed: the issue was that our source code and coverage information was not synchronized, we are using karma/istanbul/jasmine for e2e tests coverage calculation
Fixed: I remove karma-coverage and used karma-coverage-istanbul-reporter
For rollup-plugin-istanbul users, the babel plugin has to come after istanbul plugin.
https://github.com/artberri/rollup-plugin-istanbul#other-usage-options
Hi ,
I am also facing this issue and this https://github.com/gotwarlost/istanbul/pull/819
Solved it for me . Please can this issue be resolved so that we don't have to patch Istanbul ourselves.
The real problem seems not to be in "html" reporter module.
I ran into the same problem and after some investigations, I make a patch myself on the "html" reporter module to skip the error and I realize that the highlighted uncovered lines seems to be shifted with the real code.
The reason was that in my bundler (webpack) I set another loader ("imports-loader") before the "babel" one which brings instrumentation in my configuration. So "babel" took an already transformed code before to send it to "istanbul", and all offsets were shifted and wrong.
I ordered my bundler loaders to pass by "babel" loader first and all is good now 🙂
Hope this trick can help another desperate code coverage lover, and sorry for my bad english
Most helpful comment
Congratulations!! You win 1000000000 points for arriving here at the same
conclusion as we did! Here is a joke while you wait for a response:
Q: Why was everyone so tired on April 1st? A: They had just finished a
March of 31 days.
On Wed, Nov 15, 2017 at 9:26 AM, Arsen Slyusarchuk <[email protected]
--
CONFIDENTIALITY NOTICE: The contents of this email message and any
attachments are intended solely for the addressee(s) and may contain
confidential and/or privileged information and may be legally protected
from disclosure. It is then shared with tech companies, bots, hackers,
government agencies, and marketers. The security of this message is none,
and it may be shared on Instagram at anytime. If you are OK with this,
please respond. There isn't really any security or privacy anywhere. If
you disagree you may want to go camping and talk to people face-to-face
like in old times.