Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverprofile #1801

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Conversation

turbolent
Copy link
Member

Description

The current default for the test --coverprofile flag is coverage.json, i.e. creating a non-standard JSON-based coverage file. (@m-Peter or does the JSON format follow a particular "standard"?).

Switch the default to the LCOV file format, which is widely supported by tools, in particular the common file name lcov.info. Note that LCOV files are info files. To make this work, also add support for .info extension.

For example, this allows using Visual Studio Code extension Coverage Gutters:

Screenshot 2024-10-25 at 10 31 03 AM

For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@turbolent turbolent added the Improvement Technical work without new features, refactoring, improving tests label Oct 25, 2024
@turbolent turbolent self-assigned this Oct 25, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 28.47%. Comparing base (606ca7a) to head (977fd87).

Files with missing lines Patch % Lines
internal/test/test.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1801   +/-   ##
=======================================
  Coverage   28.47%   28.47%           
=======================================
  Files          95       95           
  Lines        6490     6490           
=======================================
  Hits         1848     1848           
  Misses       4462     4462           
  Partials      180      180           
Flag Coverage Δ
unittests 28.47% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jribbink jribbink merged commit 921e9bd into master Oct 25, 2024
5 checks passed
@jribbink jribbink deleted the bastian/improve-test-coverprofile branch October 25, 2024 20:44
@m-Peter
Copy link
Collaborator

m-Peter commented Oct 26, 2024

Description

The current default for the test --coverprofile flag is coverage.json, i.e. creating a non-standard JSON-based coverage file. (@m-Peter or does the JSON format follow a particular "standard"?).

Switch the default to the LCOV file format, which is widely supported by tools, in particular the common file name lcov.info. Note that LCOV files are info files. To make this work, also add support for .info extension.

For example, this allows using Visual Studio Code extension Coverage Gutters:
Screenshot 2024-10-25 at 10 31 03 AM

@turbolent Good catch 👏
The JSON format does not really follow any established standard out there, it was just the first type of format which was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Technical work without new features, refactoring, improving tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants