Open andrewl-telnyx opened 7 years ago
Presumably karma-coverage is giving istanbul html reporter bad data and istanbul has poor error recovery for that case.
Please add logging to your copy of karma-reporter to dump the collector
for reporter.writeReport(collector, true)
. Then see if you can sort out what input leads to the error.
Not sure of a solution, but this is happening to my repo as well, and I've traced it back to one location. I am testing a redux action that fires off an async request. In that action, there is an if/else:
if (request.ok) {
const data= await request.json();
dispatch(update({id: data.id, name: data.name}));
} else {
throw new Error(request.status + "- " + request.statusText);
}
For whatever reason, if I comment out the entire else block, there is no error. Strangely enough, I have to include else { ... }
, not just the throw statement.
I'm having a similar problem with flow and closure:
this will throw an error:
const test = (arg : string) : Function => (arg2 : string) => false;
this works fine
const test = (arg : string) : Function => {
return (arg2 : string) => {
return false;
};
};
Should I open a new issue?
These issues cannot be fixed in karma-coverage except by updating it to newer versions of the tools that compile your code.
a workaround is to use lcov reporter. It generates both lcov & html output but won't fail with the html.
@ffesseler, what's the npmjs package for that called?
Not a npm package, juste a reporter config.
not entirely sure if this is an issue with istanbul directly or karma-coverage, but i think it's an istanbul thing so i created this issue with them but you may want to look into it too:
the problem is:
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 you can reproduce it; just let me know what you need that i can provide and i'll provide it.