istanbuljs/v8-to-istanbul

early return causes wrong line to be identified as uncovered

Open

#81 opened on Nov 30, 2019

 (0 comments) (0 reactions) (0 assignees)JavaScript (40 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (134 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

There's a slight hiccup with merging logic that was brought to my attention here.

https://user-images.githubusercontent.com/1324510/52922996-26a90980-3360-11e9-907c-6fa464fec932.png

Here's the output that we're failing to process appropriately:

{
      "scriptId": "61",
      "url": "file:///Users/benjamincoe/bcoe/c8/foo.js",
      "functions": [
        {
          "functionName": "",
          "ranges": [
            {
              "startOffset": 0,
              "endOffset": 112,
              "count": 1
            }
          ],
          "isBlockCoverage": true
        },
        {
          "functionName": "test",
          "ranges": [
            {
              "startOffset": 0,
              "endOffset": 97,
              "count": 1
            },
            {
              "startOffset": 44,
              "endOffset": 96,
              "count": 0
            }
          ],
          "isBlockCoverage": true
        },
        {
          "functionName": "bar",
          "ranges": [
            {
              "startOffset": 50,
              "endOffset": 95,
              "count": 1
            }
          ],
          "isBlockCoverage": true
        }
      ]
    }

Contributor guide