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.

lcov.info is empty after upgrade to v14.

See original GitHub issue

Link to bug demonstration repository

https://github.com/tufan-io/node-starter

Installation (nyc@v13)

cd  /tmp
git clone https://github.com/tufan-io/node-starter demo-app
cd demo-app
npm install
# ENTER x3 to power through the prompts

It installs all dependencies (slightly dated), but the build passes and reports the proper coverage @100%.

======================= Coverage summary =======================
Statements   : 100% ( 2/2 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 1/1 )
Lines        : 100% ( 2/2 )
=============================================================

Now upgrade to nyc@14 to see the problem

npm i nyc@14
npm run test
======================= Coverage summary =======================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
=============================================================

Expected Behavior

A proper coverage report as with nyc@13 after the upgrade to nyc@14

Observed Behavior

with nyc@14, no coverage reports are being generated and the text-summary reports Unknown% ( 0/0 )

lcov.info nyc@13

$ ls -l coverage/lcov.info
-rw-r--r--  1 sramam  wheel  127 Apr 25 14:00 coverage/lcov.info

lcov.info nyc@14

$ ls -l coverage/lcov.info
-rw-r--r--  1 sramam  wheel  0 Apr 25 13:58 coverage/lcov.info

Troubleshooting steps

I have tried to change the package.json:nyc config from

# with nyc@13
"nyc": {
    "exclude": [
      "config/**/*",
      "dist/**/test/**/*.*",
      "dist/**/test/**/*.js"
    ]
}

to (and a couple more alternatives), but to no avail.

# with nyc@14
"nyc": {
    "exclude": [
      "config/**/*",
      "dist/**/test/**/*.*",
      "dist/**/test/**/*.js"
    ],
    "include": [
      "dist/**/*.js",
      "src/**/*.ts"
    ],
    "sourceMap": true,
    "instrument": true,
    "cache": true,
    "all": false
  },

What am I missing?

Environment Information

$ npx envinfo@latest --preset nyc
npx: installed 1 in 4.55s

  System:
    OS: macOS Mojave 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
    Memory: 32.61 MB / 8.00 GB
  Binaries:
    Node: 11.12.0 - ~/.nvm/versions/node/v11.12.0/bin/node
    Yarn: 1.2.1 - ~/.yarn/bin/yarn
    npm: 6.5.0 - ~/trial/v1.0.0/demo-app/node_modules/.bin/npm
  npmPackages:
    nyc: ^14.0.0 => 14.0.0
    typescript: ^3.4.5 => 3.4.5

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sramamcommented, Jul 12, 2019

@relief-melone, can you try

{
    "reporter" : ["text-summary", "text"],
    "extension": [".ts"],
    "exclude": [
        "**/test/**"
    ]
}
1reaction
sramamcommented, May 7, 2019

indeed! nyc@14.1 seems to work much better.

with

  "nyc": {
    "extension": [
      ".ts",
      ".tsx"
    ],
    "exclude": [
      "**/test/**"
    ]
  },

I was able to get

=============================== Coverage summary ===============================
Statements   : 100% ( 2/2 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 1/1 )
Lines        : 100% ( 2/2 )
================================================================================
Read more comments on GitHub >

github_iconTop Results From Across the Web

'npm run coverage' is not updating lcov.info file - Stack Overflow
UPDATE: After sharing the question on Twitter, someone suggested that I add --reporter=lcov to the coverage script and that solved it!
Read more >
Sonar reporting 0 coverage despite having lcov.info file
When I run nyc --silent jest --coverage && nyc report --clean --exit it runs the jest tests properly (where there I can see...
Read more >
Linux Test Project - Coverage » lcov - SourceForge
This fixes the following problem that can occur when lcov is run using a gcov tool of GCC version 4.7 and above on...
Read more >
JavaScript/TypeScript/CSS - SonarQube Documentation
Discover and update the JavaScript/TypeScript properties in ... This would be manifested by analysis getting stuck and the following stack trace might ...
Read more >
LCOV - llvm-toolchain.info - lib/Support/Unix/Program.inc
StringRef::npos) 75 4865 : return std::string(Name); 76 : 77 : SmallVector<StringRef, 16> EnvironmentPaths; 78 45195 : if (Paths.empty()) 79 45194 : if ...
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