-
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
Code run in setUp
functions is not counted in coverage.
#4553
Comments
Same issue |
After the support of constructor being added for coverage via this PR, I think it could be a good idea to consider the constructor code run in the As in general people tend to deploy contracts in the |
confirming this is fixed |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (a1f41be 2023-03-14T00:15:36.156534Z)
What command(s) is the bug in?
forge coverage
Operating System
macOS (Apple Silicon)
Describe the bug
In the below contract, the coverage report for the
initialize
function shows the assignment offoo = 1
; to be uncovered, as that code is only executed in thesetUp
function.and test file:
It is not clear cut to me that the coverage data should include calls from
setUp
, but my real world example is that I have multiple branches in myinitialize
function, and I want to ensure that my test suite is covering all of those branches. I can write a specific test for that but it seems redundant when the tests which execute those branches already exist.This may be related to or the same as #3453
The text was updated successfully, but these errors were encountered: