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

Typescript reports with error: property 'start' of undefined #733

Closed
ozum opened this issue Nov 30, 2017 · 7 comments
Closed

Typescript reports with error: property 'start' of undefined #733

ozum opened this issue Nov 30, 2017 · 7 comments

Comments

@ozum
Copy link

ozum commented Nov 30, 2017

Expected Behavior

Same report during repeated execution.

Observed Behavior

I have a code with 100% coverage. Using typescript and without changing any file, when I execute nyc repeatedly, I get different coverage reports.

screen shot 2017-11-30 at 14 21 26

image

(See repo below) I executed npm run test:cover 6-7 times repeatedly and once every few I got reports below 100%. Reports below 100% has following error in HTML reports:

Cannot read property 'start' of undefined
TypeError: Cannot read property 'start' of undefined
    at ...node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:50:29
    at Array.forEach ()
    at annotateStatements (...node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:46:33)
    at Object.annotateSourceCode (...node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:190:9)
    at HtmlReport.onDetail (...node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:217:39)
    at Visitor.(anonymous function) [as onDetail] (...node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
    at ReportNode.Node.visit (...node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
    at ...node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
    at Array.forEach ()
    at visitChildren (...node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)

Bonus Points! Code (or Repository) that Reproduces Issue

https://github.com/ozum/fix-set/tree/typescript-try

Forensic Information

Operating System: MacOS 10.12.6
Environment Information:

node v9.2.0
npm v5.5.1
nyc v11.3.0 or nyc v11.4.0 (Repo has v11.4.0 in package.json)

@bcoe
Copy link
Member

bcoe commented Jan 2, 2018

@ozum are you still running into this issue? I haven't been able to reproduce so far running npm run test:cover.

@ozum
Copy link
Author

ozum commented Jan 2, 2018

@bcoe, I was away from that code for a while. Currently, I also cannot reproduce. I'm closing this issue. I will open another ticket, if it happens again.

Thanks,

@ozum ozum closed this as completed Jan 2, 2018
@bcoe
Copy link
Member

bcoe commented Jan 2, 2018

@ozum great, might have been something that was fixed upstream 👍

@ZehuaZhang
Copy link

I've encountered the same problem, I don't think it's a good practice just to close the bug rather than fixing it?

@alihassan0
Copy link

I have encountered the same problem as well. nyc keeps giving different results everytime I run it (alternating between 100% coverage & 50% coverage) and I am faced with the same error when it fails. (However I don't use typescript)

@coreyfarrell
Copy link
Member

No action will be taken without a reproduction against latest nyc. If you are experiencing an issue please post a new issue and include all required information.

@ZehuaZhang
Copy link

@coreyfarrell Thanks for the reply, I've created a ticket for it #1124

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

No branches or pull requests

5 participants