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

coverage report looks not good #116

Open

Description

@mariodu

image

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

Activity

  1. yyx990803 commented on May 16, 2016

    @yyx990803

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions