-
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
Fuzz testing only catches console.log in setUp()
and in failing test functions, not passing functions
#3843
Comments
Would be great to fix this. Any updates? |
Simple way to reproduce: import "forge-std/Test.sol";
contract Test5 is Test {
function setUp() public {
console2.log("Test5.setUp()");
}
function test_FuzzVals(uint x) external {
console2.log("Test5.test_FuzzVals()");
}
} As shown in the screenshot below, When all runs of a fuzz test are successful, the trace shows the values from the last run. The console.logs should do the same |
running into the same issue. tried both console and console2 but its not outputting . only prints if it is in setUp() |
cc @Evalir, I just verified this bug is still occurring on the latest nightly using the repro in #3843 (comment). Guessing this is a simple fix |
So, I can confirm this is an issue—even though just fixing it could make everyone's CI or local runs extremely noisy as a default. @mds1 this is somewhat easy fix, but I wonder if we should put this behind some kind of flag or increase the verbosity level needed for printing fuzz logs? |
We already would show the logs if it was a regular test and not a fuzz test, so I think this is ok? Unclear why we'd want to handle the console.logs differently between the two, it seems unintuitive. To hide the logs you'd just run with |
Any update on this issue? I really need to show logs in fuzz tests for both failed and success results. |
Bump to this, also looking to get output on each fuzz test, not just the failing ones |
+1 to this use case being valuable |
still have it ;( |
+1 to this is |
+1 |
|
having this feature would be great. I think the only readability issue will be there because fuzzing runs the function too many times and logging every time will spam the terminal |
+1 to this |
+1 to this This feature is immensely required. |
#7781 is now merged |
exciting... |
I think we could track it woth #3844 |
how should this feature be implemented? i didn't take every situation into consideration in my last try. i'm still using locally built foundry when fuzz logs are needed 😅 |
+1 would love to see fuzzing results logged |
+1. when will this be available ? |
+1 |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (2e99f7f 2022-12-03T00:08:28.619060629Z)
What command(s) is the bug in?
forge test
Operating System
Linux
Describe the bug
Similar to issue #655, which was closed as stale (creating a new issue since there have been changes since that issue, and mine may be subtly different).
Only console logs in failing functions and
setUp()
are showing in the Logs section of the results, above the traces, but not the logs in passing functions. I can see the other calls toconsole::log
in the traces, but they're not getting formatted.This would be fine if I were only trying to do one run, but since I'm fuzzing, I'd like to see all of the logs without printing all of the traces.
I have added a minimized test contract in my repo for reproducing this bug:
https://github.com/webthethird/solidity-diff-fuzz-upgrades/blob/main/src/test/test_logging.sol
The text was updated successfully, but these errors were encountered: