v8/v8.dev

coverage data missing uncovered functions

cek333 opened this issue · 1 comments

Hello.

I'm using startPreciseCoverage / takePreciseCoverage to extract code coverage data from Chrome (i.e. v8).

My issue: data from uncovered functions are missing from the dumped data.
For example, assume the handleSubmit function in authors.js is not called. I expect to see this:

    {
      "scriptId": "16",
      "url": "file:///home/<user>/v8-chrome-coverage-wdio-sync/public/js/authors.js",
      "functions": [
        {
          "functionName": "",
          "ranges": [{ "startOffset": 0, "endOffset": 828, "count": 1 }],
          "isBlockCoverage": true
        },
        {
          "functionName": "showContent",
          "ranges": [{ "startOffset": 71, "endOffset": 448, "count": 1 }],
          "isBlockCoverage": true
        },
        {
          "functionName": "",
          "ranges": [{ "startOffset": 274, "endOffset": 444, "count": 3 }],
          "isBlockCoverage": true
        },
        {
          "functionName": "handleSubmit",
          "ranges": [{ "startOffset": 450, "endOffset": 703, "count": 0 }],
          "isBlockCoverage": false
        }
      ]
    },

but instead I get this:

    {
      "scriptId": "16",
      "url": "file:///home/<user>/v8-chrome-coverage-wdio-sync/public/js/authors.js",
      "functions": [
        {
          "functionName": "",
          "ranges": [{ "startOffset": 0, "endOffset": 828, "count": 1 }],
          "isBlockCoverage": true
        },
        {
          "functionName": "showContent",
          "ranges": [{ "startOffset": 71, "endOffset": 448, "count": 1 }],
          "isBlockCoverage": true
        },
        {
          "functionName": "",
          "ranges": [{ "startOffset": 274, "endOffset": 444, "count": 3 }],
          "isBlockCoverage": true
        }
      ]
    },

i.e. there is no data at all on the uncovered function. This causes the c8 report tool to generate an invalid report.

I tried to create simple reproductions that I could share, however all my simple projects are working fine.

Any suggestions or tips on what I could try to debug the problem would be appreciated.

(FYI ... here's a working version of the flow on a smaller project ... if it helps to make it clear what I'm trying to achieve: https://github.com/cek333/v8-chrome-coverage-wdio-sync)

Thanks.

This is not the right place to report this issue.