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

Tracking: Coverage #1961

Closed
8 tasks done
onbjerg opened this issue Jun 14, 2022 · 7 comments
Closed
8 tasks done

Tracking: Coverage #1961

onbjerg opened this issue Jun 14, 2022 · 7 comments
Assignees
Labels
C-forge Command: forge Cmd-forge-coverage Command: forge coverage T-meta Type: meta
Milestone

Comments

@onbjerg
Copy link
Member

onbjerg commented Jun 14, 2022

There's still some missing features and improvements for coverage:

Data/functionality

User facing

Misc

@onbjerg onbjerg added C-forge Command: forge T-meta Type: meta labels Jun 14, 2022
@onbjerg onbjerg self-assigned this Jun 14, 2022
@onbjerg onbjerg added the Cmd-forge-coverage Command: forge coverage label Jun 14, 2022
@onbjerg onbjerg added this to the v1.0.0 milestone Jul 1, 2022
@aahna-ashina
Copy link

aahna-ashina commented Jul 16, 2022

@onbjerg When I run forge coverage at https://github.com/nation3/court, I get this error:

could not find anchor: no matching instruction in range CollateralAgreementFramework:3834:2:7
forge coverage 
warning: Unknown section [default] found in foundry.toml. This notation for profiles has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead or run `forge config --fix`.
warning: Unknown section [default] found in lib/solmate/foundry.toml. This notation for profiles has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead or run `forge config --fix`.
warning: Unknown section [intense] found in lib/solmate/foundry.toml. This notation for profiles has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead or run `forge config --fix`.
[⠒] Compiling...
[⠒] Compiling 11 files with 0.8.14
[⠑] Solc 0.8.14 finished in 992.33ms
Compiler run successful
Analysing contracts...
Error: 
could not find anchor: no matching instruction in range CollateralAgreementFramework:3834:2:7

Does could not find anchor mean that we are missing some code coverage configuration in our project?

forge --version
forge 0.2.0 (37e4376 2022-07-16T00:05:51.461078Z)

@onbjerg
Copy link
Member Author

onbjerg commented Jul 16, 2022

Please check the other issues on coverage - this is not on your side, but coverage is not stable yet, so there are edge cases that are not covered. This is one edge case where it could not find an opcode that matches the source range, so we fail and return instead of showing a potentially incorrect coverage report

@aahna-ashina
Copy link

aahna-ashina commented Aug 18, 2022

@onbjerg Is there a way to exclude *.sol files in the test/ folder when running forge coverage?

@elenadimitrova
Copy link

elenadimitrova commented Aug 18, 2022

@aahna-ashina I had the same question and what I ended up doing is exclude them in codecov.yml instead with:

ignore:
  - "./tests/"

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Jan 2, 2023

Thanks @elenadimitrova, great idea to ignore the tests in Codecov directly.

However, it should be possible to do this with Forge itself - ideally, there would be a --ignore flag in the forge coverage command.

I created an issue to track this as a feature request: #4006.

Update: it looks like it is not possible to ignore globs on all coverage tracking platforms - for instance, Coveralls doesn't offer this feature. Thus, it would be really helpful for Foundry to have an --ignore flag.

@zerosnacks
Copy link
Member

Closing in favor of #4442 as updated metatracking ticket, includes the bugs stated in #1961 (comment)

@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-coverage Command: forge coverage T-meta Type: meta
Projects
Status: Completed
Development

No branches or pull requests

5 participants