nyc icon indicating copy to clipboard operation
nyc copied to clipboard

nyc reports ZERO(0) coverage on all platforms. (PoC repo included)

Open GerHobbelt opened this issue 3 years ago • 3 comments

Link to bug demonstration repository

https://github.com/GerHobbelt/nyc-PoC-0001

Expected Behavior

100% coverage report; this is a very simple repo with a 1-line function to test and running nyc mocha as test command.

Observed Behavior

shows an all-zeroes coverage report like this:

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

while the expected coverage report should say something along the lines of '100% coverage': see the code in test/test.js running a few tests, exercising the very simple code in lib/index.js, after all.

P.S.: circleCI runs and reports ALL GREEN/SUCCESS, but do check those numbers: they are still ZERO there too!

Adding commandline options like --functions 90, etc. doesn't help one bit as 90% of zero is still ZERO and apparently considered a PASS. 😭

Environment Information

Happens already some considerable time on Windows 10/64 dev boxes (Node 10 upwards)

Now also observed on any CI's I tried.

envinfo: paste the output here

  System:
    OS: Windows 10 10.0.18362
    CPU: (8) x64 Intel(R) Core(TM) i7-4700HQ CPU @ 2.40GHz
    Memory: 5.29 GB / 15.89 GB
  Binaries:
    Node: 16.4.1 - C:\Program Files\nodejs\node.EXE
    npm: 7.19.1 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    nyc: 15.1.0 => 15.1.0

and

System:
    OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
    Memory: 5.03 GB / 6.79 GB
  Binaries:
    Node: 12.22.1 - /opt/hostedtoolcache/node/12.22.1/x64/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.12 - /opt/hostedtoolcache/node/12.22.1/x64/bin/npm
  npmPackages:
    nyc: 15.1.0 => 15.1.0 

plus plenty more. (both CI configs (Circle & GitHub) run matrix on Node 12, 14, and 16. Add more if you like. envinfo is part of the npm test output in all runs.

GerHobbelt avatar Jul 05 '21 18:07 GerHobbelt

me too

AngelaWanChina2021 avatar Nov 05 '21 07:11 AngelaWanChina2021

I also have this, but I'm on a private repo that I can't share. nyc v^15.1.0 lcov says 0/0, the text report just says

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

Made a hello world project with our dependencies that can repro the issue here

redoxeon avatar Nov 05 '21 20:11 redoxeon

FYI, I've updated the repo with a reduced dependency list to have the minimum to work. I wasn't able to remove a dependency that made the coverage work, sadly

redoxeon avatar Dec 07 '21 21:12 redoxeon