c8 icon indicating copy to clipboard operation
c8 copied to clipboard

Code Coverage Report is Empty even will valid coverage/tmp/xxxxx.json generated...

Open tonysoft opened this issue 7 years ago • 7 comments

  • Version:
  • Platform:

Run a c8 Code Coverage session with my Node API Project with this Command Line: c8 -r html -x node_modules node server.js

I hit a few APIs and then cleanly terminate the Server.

coverage/tmp/coverage-8140-1545948692773-0.json gets created and its Coverage is as expected.

But the HTML report generated by Istanbul is essentially empty. Has the headings, but nothing is really there.

I can manually parse the file and create my own report out of it, but I don't really want to do that.

THANKS for c8... Once I get it working, it will truly change how I look at Testing...

Here is a snippet below from the Coverage JSON file:

{ "scriptId": "453", "url": "file:///C:/Users/tsukiennik/terraPoint/terraPoint/rapierWorkflow/lib/rapierUtils.js", "functions": [{ "functionName": "", "ranges": [{ "startOffset": 0, "endOffset": 41264, "count": 1 }], "isBlockCoverage": true }, { "functionName": "", "ranges": [{ "startOffset": 1, "endOffset": 41262, "count": 1 }], "isBlockCoverage": true }, { "functionName": "exports.setRunnerMode", "ranges": [{ "startOffset": 1371, "endOffset": 2297, "count": 4 }, {

tonysoft avatar Dec 27 '18 22:12 tonysoft

👋 hey @tonysoft sorry for the slow response, I got to the point near the end of this year where I was literally 2000+ tickets behind in open-source.

This is odd, the raw output itself looks reasonable; perhaps you could create a testing repo with a minimal reproduction for us to dig into.

bcoe avatar Dec 29 '18 16:12 bcoe

No worries Benjamin... I will isolate this to a simple test case and create a repo... Don't apologize as you are doing the Community a great Service...

No hurry though, I'm actually building an interactive Coverage Explorer into my Presentation App. I'm fleshing it out right now...

When I'm done, I'll create a Video of it and it may be of interest to the Community.

Sometimes when you hit an obstacle, it points you in a direction you should have thought of anyway.

Onward... Tony

On Sat, Dec 29, 2018 at 8:29 AM Benjamin E. Coe [email protected] wrote:

👋 hey @tonysoft https://github.com/tonysoft sorry for the slow response, I got to the point near the end of this year where I was literally 2000+ tickets behind in open-source.

This is odd, the raw output itself looks reasonable; perhaps you could create a testing repo with a minimal reproduction for us to dig into.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bcoe/c8/issues/53#issuecomment-450504126, or mute the thread https://github.com/notifications/unsubscribe-auth/AC9qL6SNPt_dimtXgttjUoQNQXHmfvJmks5u95hNgaJpZM4ZjPzF .

tonysoft avatar Dec 29 '18 18:12 tonysoft

I will isolate this to a simple test case and create a repo

Friendly ping @tonysoft

shinnn avatar Apr 28 '19 21:04 shinnn

@tonysoft closing this as inactive, please feel free to reopen if you're able to provide a repo demonstrating the issue.

There's been quite a bit of work on c8 over the past year, so you might also try the latest version.

bcoe avatar Oct 24 '19 05:10 bcoe

I'm running into the same issue. The text reporter works fine, but the html reporter generates a .json file instead of html output. I'm using version 7.1.0 of c8.

k4b7 avatar Apr 20 '20 03:04 k4b7

I'm also getting some other errors in the output, e.g.

file: /Users/kevinbarabash/zippers/output/Test.Spec.Summary/index.js error: Error: Error parsing mappings (code 1): the mappings contained a negative line, column, source index, or name index
    at BasicSourceMapConsumer._parseMappings (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/node_modules/source-map/lib/source-map-consumer.js:360:13)
    at BasicSourceMapConsumer._getMappingsPtr (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/node_modules/source-map/lib/source-map-consumer.js:315:12)
    at _wasm.withMappingCallback (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/node_modules/source-map/lib/source-map-consumer.js:510:14)
    at Object.withMappingCallback (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/node_modules/source-map/lib/wasm.js:95:11)
    at BasicSourceMapConsumer.originalPositionFor (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/node_modules/source-map/lib/source-map-consumer.js:508:16)
    at originalPositionTryBoth (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/lib/source.js:173:30)
    at CovSource.offsetToOriginalRelative (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/lib/source.js:56:19)
    at V8ToIstanbul._maybeRemapStartColEndCol (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:167:84)
    at block.ranges.forEach (/Users/kevinbarabash/zippers/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:92:18)
    at Array.forEach (<anonymous>)

It's possible that these are interfering with c8's ability to generate the HTML report. I'm going to try to dig into the sourcemap issue sometime this week.

k4b7 avatar Apr 20 '20 03:04 k4b7

I recompiled my project without sourcemaps and I'm still running into the same issue with a .json file for output instead of HTML.

k4b7 avatar Apr 20 '20 03:04 k4b7