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.

Feature Request: Instrument option to generate a baseline coverage file

See original GitHub issue

Problem

Currently when testing with files created by the standalone instrument command, if a file isn’t hit it will not produce a coverage output file. This can lead to untouched files being excluded from the coverage report. Istanbul handled this by being able to produce a baseline coverage file with content similar to that produced by running nyc --all=true /usr/bin/true. When the baseline coverage file is included with test generated coverage files and fed to the reporter, files that aren’t hit during tests are included in the report.

In hindsight I think this was the problem being faced in #1044.

Proposal

Add an option to the instrument command, ‘baseline’, that will produce a baseline coverage output json file similar to that produced by running nyc --all=true /usr/bin/true.

Workaround

You can generate a report that includes untouched files with:

  1. run nyc --all <options> /usr/bin/true against the uninstrumented code
  2. store the output coverage file
  3. instrument the source
  4. run tests
  5. combine baseline and test coverage files
  6. report on combined coverage files

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewFinlaycommented, Oct 16, 2019

I’ll try and put together a demo project but it might take a little time as I’m seeing the issue on internal source that I can’t share without some redaction. I’ll drop it into a new issue as it’s a little off topic in here.

0reactions
AndrewFinlaycommented, Jan 19, 2020

I’ve been thinking a little bit about this feature and it seems to me that we really want is what nyc --all ... currently does. We should implement nyc instrument --all, then it’s quite reasonable to expect the two --all commands to behave in the same way. No need for a separate baseline directory, the filename can stay <uuid>.json and the processInfo files would still be there if needed.

This also simplifies the interface and the documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coverage.py — Coverage.py 7.0.1 documentation
Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been...
Read more >
NetSuite Applications Suite - Setting a Project Baseline
Then, you can use the baseline data for comparison to actual work and revised schedules later in the execution phase of your project....
Read more >
Product Filing Review Handbook - NAIC
The Product Filing Review Handbook is intended to help insurance regulators provide speed to market for insurers while.
Read more >
Xcode 13 Release Notes | Apple Developer Documentation
Update your apps to use new features, and test your apps against API changes. ... The build options sheet now includes a Dependency...
Read more >
Microsoft Edge Browser Policy Documentation
For more information see the Microsoft Security Baselines Blog. ... the View in File Explorer feature for SharePoint pages in Microsoft Edge.
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