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

Allow specifying a mapping with source paths for locations in coverage reports #2859

Merged
merged 3 commits into from
Oct 23, 2023

Conversation

m-Peter
Copy link
Contributor

@m-Peter m-Peter commented Oct 9, 2023

Description

Having AddressLocation or StringLocation in coverage reports, is not usable when trying to use these reports with standard tools, such as LCOV. The file path is what is needed to exploit the existing tools dealing with the LCOV format.

The flow.json config file, already defines the source file for all contracts involved in a dApp, e.g.:

{
  "contracts": {
    "ApprovalVoting": {
      "source": "contracts/ApprovalVoting.cdc",
      "aliases": {
        "testing": "0000000000000007"
      }
    },
    "ArrayUtils": {
      "source": "contracts/ArrayUtils.cdc",
      "aliases": {
        "testing": "0000000000000007"
      }
    },
    "FooContract": {
      "source": "contracts/FooContract.cdc",
      "aliases": {
        "testing": "0000000000000007"
      }
    },
    "StringUtils": {
      "source": "contracts/StringUtils.cdc",
      "aliases": {
        "testing": "0000000000000007"
      }
    }
  }
}

  • 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

…in coverage reports

Having AddressLocation or StringLocation in coverage reports, is not usable
when trying to use these reports with standard tools, such as LCOV.
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (735a071) 79.38% compared to head (6b9d9f2) 79.41%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2859      +/-   ##
==========================================
+ Coverage   79.38%   79.41%   +0.02%     
==========================================
  Files         334      334              
  Lines       78826    78930     +104     
==========================================
+ Hits        62576    62680     +104     
+ Misses      13944    13943       -1     
- Partials     2306     2307       +1     
Flag Coverage Δ
unittests 79.41% <100.00%> (+0.02%) ⬆️

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

Files Coverage Δ
runtime/coverage.go 94.13% <100.00%> (+0.32%) ⬆️

... and 6 files with indirect coverage changes

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

runtime/coverage.go Outdated Show resolved Hide resolved
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Only have one concern regarding location clashes

runtime/coverage.go Outdated Show resolved Hide resolved
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

runtime/coverage.go Outdated Show resolved Hide resolved
runtime/coverage.go Outdated Show resolved Hide resolved
runtime/coverage.go Outdated Show resolved Hide resolved
@m-Peter m-Peter changed the title Allow specifying a mapping with human-friendly aliases for locations in coverage reports Allow specifying a mapping with source paths for locations in coverage reports Oct 16, 2023
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@SupunS SupunS requested a review from turbolent October 23, 2023 15:45
@turbolent
Copy link
Member

Nice!

@turbolent turbolent merged commit 2f573e2 into onflow:master Oct 23, 2023
12 of 14 checks passed
@m-Peter m-Peter deleted the coverage-report-source-file-mappings branch January 12, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants