-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
vm.expectEmit
fails
#5506
Comments
thanks for reporting this! I know reproing was unsuccessful, but could we at least get a few instructions on how to repro with your repo? It's much harder to track this down otherwise |
The contracts are part of a larger protocol that's in a private repo, so I can't share any of the code, but I'll try modify the example to better resemble the conditions. |
This is happening as well on my end. Things in common:
|
Hey @jmanywhere i can't reproduce—I downloaded your repo, and using the latest foundry version I uncommented the offending part and it passed. Also tried moving the prank after the expect emit and subsequent event emission (which should be the correct usage too) and can't reproduce as well. everything works fine. Also working on an M1 Mac here. Inclined to close if this can't be accurately reproduced, because if it was a more widespread issue we'd see more reports. |
Thanks @Evalir will run foundryup again and reach back. |
Running into this issue on a M1 Mac as well. Tests pass with the expectEmit(...) commented out and I can see the events correctly emitted in the trace logs.
Update: no bug, I was just being stupid |
Same issue, but on Windows 10 here. Commenting out expectEmit(...) works with the events emitting correctly in the logs. I am following along a YouTube tutorial, and it works fine in his code and I am following along exactly the same way but the error persists. timestamp: https://youtu.be/sas02qSFZ74?si=kLOd8xjAs6iHCUep&t=18742 |
Hey all - was running into similar issue. Figured out I needed to redefine the events in my test contract (they're not inherited, as they are NOT types like enums/structs/etc.). Hope this saves someone some time. |
Sadly I'm still experiencing this issue. I have tried all of the above solutions mentioned in the comments and nothing works for me.
I make use of |
I have a common file that all my tests inherit from which includes the event definitions. As a sanity check, I commented out the offending event and moved it into the test file. No dice. |
Sharing your issue/solution might be helpful here. |
Even I'm facing a similar issue. I've defined it here👇🏾 Awaiting for help on this. Thanks! |
This was fixed! The issue was that I had not followed the sequence of calls for a successful |
Hi @Craigson are you still facing issues around this? |
Optimistically marking as |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (d93312b 2023-07-30T00:26:55.660686000Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
After running
foundryup
for the first time in a while, all of my tests containingvm.expectEmit
are suddenly failing. I cannot create a new test to reproduce the issue, as the behavior in the new test is as expected. I have read through #5117 and other similar issues, but none seem to apply to my use case. Here is my test:I have confirmed that both events, defined in my contract, and my test file, are identical.
I tried moving the event definition into the test file, and still no dice. From the console output, we can see that the event is fired inside the first call being made, and the args match exactly.
The reason seems to indicate that the issue has to do with the call reverting, but that is expected behaviour with the
expectRevert
included. As a sanity check, the test still fails when theexpectRevert
portion of the test is commented out.Attempting to reproduce the error was unsuccessful, as the behavior is as expected and the test passes:
I have tried expecting the emission with all values set to false, and without any args, and the result is the same.
The text was updated successfully, but these errors were encountered: