Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

coverage report looks not good #116

Open
mariodu opened this issue Apr 5, 2016 · 1 comment
Open

coverage report looks not good #116

mariodu opened this issue Apr 5, 2016 · 1 comment

Comments

@mariodu
Copy link

mariodu commented Apr 5, 2016

image

It seems that can't deal with '||'.

@yyx990803
Copy link

yyx990803 commented May 16, 2016

I spent some time digging into this issue and this is what I found:

Isparta extends Istanbul's Instrumenter class and overrides the input code with babel generated code, and patches the generated metrics (statementMap, fnMap, branchMap) using the source map generated by Babel, mapping the generated positions back to the original positions in the source code. However, Babel's source map isn't detailed enough to return the precise end position for any expression. For example, it returns a column number of 0 for the end position of expressions that are part of:

  • a boolean expression, e.g. a || b
  • a ternary expression, e.g. a ? b : c

When Istanbul's HTML reporter is generating the HTML, it attempts to wrap the skipped branch, e.g. b with a <span>, however the end column is smaller than the starter column, so it fails to insert the closing </span>, causing the "skipped branch" span to include everything until the end of file.

I don't see a way to fix this other than asking Babel to provide source maps with better precision, but I also don't think it's going to be easy.

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

No branches or pull requests

2 participants