gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Fix js error #819

Open cenkingunlugu opened 7 years ago

cenkingunlugu commented 7 years ago

Fix js error when there is no structuredText of startLine or structuredText of startLine has not text attribute.

Also fixes this issueon karma-coverage: https://github.com/karma-runner/karma-coverage/issues/167

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 97.523% when pulling aeed31615dc6051cd26c92ba4891694e6b84e275 on cenkingunlugu:master into bc84c315271a5dd4d39bcefc5925cfb61a3d174a on gotwarlost:master.

cenkingunlugu commented 7 years ago

Also solves: https://github.com/gotwarlost/istanbul/issues/817

glazar commented 7 years ago

I have a PR for only part of these changes. These should be linked.

dmi3y commented 7 years ago

Does anyone figured why this happening? In my case, doing migration js>ts(x) and just started to seeing this error. Assuming some upstream is screwing the sourcemaps (webpack + babel (react) + typescript + karma)?

mebibou commented 6 years ago

@FezVrasta yes this is not a fix, it's just a "silent" fail. I think there should be an error thrown instead that just looks better than "TypeError", which would tell you that the coverage report cannot be mapped to the source file. In my case, this happens because I am using TypeScript and so the coverage does not really cover the source file. I'm trying to switch and use karma-typescript with coverage to make it work but been quite unsuccessful so far

fp-Kuba commented 6 years ago

+1 👍