question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code coverage report is empty

See original GitHub issue

Given the following file structure:

src
 - example.js
test
 - my-first-test.js

example.js

module.exports = {
    everything: function () {
        return 'cool';
    }
}

my-first-test.js

let { everything } = require('../src/example');

export function testThatEverythingIsCool(t) {
    let result = everything();
    t.assert(result === 'cool', 'Make sure that everything is cool');
}

Running npx luna test/* --node --verbose results in the following:

🌙  Running tests…
✔︎  [test/my-first-test.js] testThatEverythingIsCool
   All tests passed!

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================

   HTML coverage report available at coverage/lcov-report/index.html
   Took 0.55 seconds

Maybe I’m running it wrong somehow, but shouldn’t it be showing 100% coverage for this simple test?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ccampbellcommented, Jun 19, 2018

Aha! I found a solution…

If you do

npm install nyc

Then run as

npx nyc luna test/* --node --verbose

it works!

0reactions
ccampbellcommented, Jun 19, 2018

Haha yup. that looks like a bug with yargs though. Or at least my expectation of how it should work. If you pass --no-coverage=1 it works, but passing it alone does not work.

Oh wow. It is the library itself being smarter than I am. If you name a flag --no-{flag} it comes in as flag: false. Instead of 'no-{flag}': true which was what I expected here. Personally I think the library is trying to be too smart, it should add both, but it is an easy fix

Read more comments on GitHub >

github_iconTop Results From Across the Web

Empty Code Coverage Report · Issue #532 - gcov - GitHub
Hello, I am running ceedling and gcov for a project of mine. Ceedling runs fine, GCov runs fine. However my generated report is...
Read more >
Re: Code coverage report empty - Google Groups
I get a blank coverage report with 100% and no files. My config looks like this: // base path, that will be used...
Read more >
Code Coverage results empty (again) - Visual Studio Feedback
We found out that some customers have issue with missing code coverage dependencies. We are fixing it. A fix for this issue has...
Read more >
Code coverage statistics data is empty and ... - Stack Overflow
I'm using Jacoco for code coverage and visualizing it, visualizing is working well but Code coverage statistics data is empty and the ...
Read more >
OpenCover generates an empty report - SonarQube
I want to get the code coverage report. Using dotnet CLI to run the tests. The tests are running and the file is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found