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.

Inconsistent coverage levels between runs with "all"

See original GitHub issue

Link to bug demonstration repository

I’ve seen a few other issues reporting similar symptoms, but their fixes are things I’m already doing or are not applicable (different tools): https://github.com/istanbuljs/nyc/issues/981

Expected Behavior

Repeated runs produce the same result (which is expected to be 100% here).

Observed Behavior

Repeated runs produce 92% or 100% coverage.

Troubleshooting steps

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

Environment Information

System:
    OS: Linux 4.18 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
    Memory: 557.58 MB / 7.64 GB
  Binaries:
    Node: 11.15.0 - /usr/bin/node
    npm: 6.7.0 - /usr/bin/npm
  npmPackages:
    nyc: ^14.1.1 => 14.1.1 
    ts-node: ^8.1.0 => 8.1.0 
    typescript: ^3.4.5 => 3.4.5 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bcoecommented, Jun 17, 2019

@elliot-nelson great digging. I’ve seen this issue for several years, and you’re correct it seems to be a race condition between which JSON file is loaded from .nyc_output first.

I would love to better document how to avoid this problem, as it’s a frequent complaint for TypeScript users. If TypeScript is being built before running tests, It might also be worth looking at c8 which I’ve been finding works a bit better for my TypeScript libraries (the disclaimer being it doesn’t work if TypeScript is being dynamically built in tests).

0reactions
jameswilddevcommented, Jun 13, 2019

That makes sense, and explains why all would trigger it if it’s actively looking for files to include and picking up ones it shouldn’t. Going to have to play and see if I can fix it my end but doubtful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inconsistencies between coverage summary of build and ...
runsettings file, I get 81.73% (Builds) and 76.59% (PR) (unit test project seems to be part of the coverage calculation) Downloading the code...
Read more >
Inconsistent Coverage Report by NYC · Issue #537 - GitHub
Same issue on nyc v12.0.2 and QUnit v2.6.1. The coverage rates and uncovered line #s vary across runs when all is enabled.
Read more >
Inconsistent coverage results using dotCover console runner ...
The coverage results are always 0% or change from run to run (even if there were no changes in the analyzed assemblies). Possible...
Read more >
Inconsistent Code Coverage results - Salesforce Developers
When we attempt to deploy a new changeset to production (even one without new APEX code) the system runs though our test cases...
Read more >
Jacoco coverage inconsistent on anonymous classes
The problem seems to be anonymous classes - they are sometimes not lining up with the test run - even though it's all...
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