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.

nyc on Windows shows 0 coverage

See original GitHub issue

Link to bug demonstration repository

https://github.com/mariszin/nyc-coverage-0-sample

(Taken from #1076…)

Expected Behavior

After tests, nyc should show 100% coverage

Observed Behavior

When running tests on Windows, the coverage is 0. Not even after upgrading to nyc@15

C:\ws\nyc-coverage-0-sample>nyc mocha


  HelloWorld
    √ should return hello world with no arguments
    √ should return passed argument


  2 passing (6ms)

---------------|----------|----------|----------|----------|-------------------|
File           |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
---------------|----------|----------|----------|----------|-------------------|
All files      |        0 |        0 |        0 |        0 |                   |
 helloWorld.js |        0 |        0 |        0 |        0 |         1,2,3,5,9 |
---------------|----------|----------|----------|----------|-------------------|


C:\ws\nyc-coverage-0-sample>npm ls nyc
nyc-coverage-0@1.0.0 C:\nyc-coverage-0-sample
`-- nyc@14.1.1


C:\ws\nyc-coverage-0-sample>npm i nyc@15 --save-dev
npm WARN nyc-coverage-0@1.0.0 No description                                                                                                                                          bel\helper-module-transforms-1c5a7680 (356ms)
npm WARN nyc-coverage-0@1.0.0 No repository field.

+ nyc@15.1.0
added 65 packages from 26 contributors, removed 29 packages and updated 25 packages in 11.652s

25 packages are looking for funding
  run `npm fund` for details


C:\ws\nyc-coverage-0-sample>nyc mocha


  HelloWorld
    √ should return hello world with no arguments
    √ should return passed argument


  2 passing (7ms)

---------------|---------|----------|---------|---------|-------------------
File           | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------|---------|----------|---------|---------|-------------------
All files      |       0 |        0 |       0 |       0 |
 helloWorld.js |       0 |        0 |       0 |       0 | 1-9
---------------|---------|----------|---------|---------|-------------------

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config

Environment Information

C:\ws\nyc-coverage-0-sample>npx envinfo@latest --preset nyc
'npx' is not recognized as an internal or external command,
operable program or batch file.

C:\ws\nyc-coverage-0-sample>npm i -g envinfo
C:\Program Files (x86)\Nodist\bin\envinfo -> C:\Program Files (x86)\Nodist\bin\node_modules\envinfo\dist\cli.js                                                                       node_modules\.staging
+ envinfo@7.7.3
added 1 package from 1 contributor in 0.862s

C:\ws\nyc-coverage-0-sample>envinfo --preset nyc

  System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 2.95 GB / 15.85 GB
  Binaries:
    Node: 12.18.4 - C:\Program Files (x86)\Nodist\bin\node.EXE
    npm: 6.14.6 - C:\Program Files (x86)\Nodist\bin\npm.EXE
  npmPackages:
    nyc: ^15.1.0 => 15.1.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:16

github_iconTop GitHub Comments

1reaction
andschwacommented, Oct 6, 2021

I hope that nyc gets fixed for Windows and updated, I’d like to use it, but right now it’s not usable on Windows at all.

0reactions
oshercommented, Sep 19, 2021

any decision?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does nyc does not gather test coverage for my project?
To gather the test coverage I am using nyc. When I run npm run coverage I see all my test cases are getting...
Read more >
Glossary of Zoning Terms - DCP - NYC.gov
This glossary provides brief explanations of planning and zoning terminology, including terms highlighted in the Zoning Handbook. Words and phrases followed ...
Read more >
Code coverage testing - Visual Studio (Windows)
Learn how to use the code coverage feature of Visual Studio to determine what proportion of your project code is being tested by...
Read more >
Code coverage | WebStorm Documentation - JetBrains
To reopen the Coverage tool window, select Run | Show Code Coverage Data from the main menu, or press Ctrl+Alt+F6 . The tool...
Read more >
Code Coverage - Cypress Documentation
Then we show how to save the coverage information and generate reports using ... The nyc and babel-plugin-istanbul only instrument the application code...
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