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.

Rerun Test Coverage Multiple Times Produce Different Coverage Results

See original GitHub issue

Link to bug demonstration repository

I’ve followed this link in nyc npm, since we use typescript

Run tests multiple times with test coverage enabled results in different results-

Expected Behavior

image

Observed Behavior

Half times is 85% image

Half times is 68% image

Interesting fact When the percentage is higher, which is correct, I could see each code file coverage But when the percentage is lower, which is incorrect, when I click each code file, some files instead of showing the code and coverage for each line, shows below message

image

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config This does nothing for me

Environment Information

# paste the output here

System:
    OS: macOS 10.14.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 567.67 MB / 16.00 GB
  Binaries:
    Node: 12.3.1 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  npmPackages:
    nyc: ^14.1.1 => 14.1.1 
    source-map-support: ^0.5.12 => 0.5.12 
    ts-node: ^8.1.0 => 8.2.0 
    typescript: ^3.1.1 => 3.5.1 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
goducommented, Jun 5, 2019

I may have a solution :

  • .nycrc
{
	...
	"require": ["ts-node/register"]
}
1reaction
corradopetrelliunicamcommented, Dec 2, 2019

@godu thank you so much! It works

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Code Coverage - Visual Studio (Windows)
When you modify and rerun your tests, a previous code coverage result can still be visible, including the code coloring from that old...
Read more >
How to rerun failed test cases and add coverage in previous ...
After i rerun the failed testcases , the test cases passed but then after new coverage came for these failed test cases. I...
Read more >
Use Continuous Testing | dotCover Documentation - JetBrains
dotCover tutorial, how to run continuous testing, test driven ... Coverage results will be shown in a separate Unit Tests Coverage window.
Read more >
Collect Coverage in Tests - MATLAB & Simulink - MathWorks
To aggregate results from different test files into a single result set, select the separate results in the Results and Artifacts list. Then,...
Read more >
CS253 | Lab / Coverage - Colorado State University
People have a natural tendency to test only the parts of the code that they're ... It tells you how many times each...
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