-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(forge): add coverage to test setUp #6123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable—Is it possible for you to provide a screenshot of this working when using lcov or something similar for vis? Just to ensure everything looks okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will also need rebasing—sorry about this, lots of moving parts rn, we'll be done soon!
7809b1d
to
f49caaf
Compare
@Evalir Thanks for the review. PR's been rebased and I've added lcov generated reports of the changes to the PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, looks reasonable, and tests look good. Pending @mattsse and nit
Motivation
Improve forge coverage reporting of functions called during test
setUp
. This allows initializer functions, but not ctors, called during setUp (ex: #4553) to be covered.Solution
The
TestSetup
is extended to include coverage info. ThesetUp
coverage is then merged withHitMaps
generated by test runners.Consider the coverage reporting of the
CounterTest:test_Increment
test generated byforge init
. Prior to this change, we see thatCounter.setNumber
isn't covered because it's only called duringsetUp
:With this patch, we get full test coverage in
Counter.sol
: