Closed PaulRBerg closed 5 years ago
eventEmitted
takes a filter function that returns true
if the event should be included in the filtered output or false
if it shouldn't. In the test you provided, it never returns true
so no events are included in the filtered output.
Does the bug still persist if you change the filter function to return a boolean?
Oh, I see! so eventEmitted
in and of itself is the test assertion.
I confirm that by returning true
, the error disappeared. Thanks!
Exactly. Good to hear that it works for you now :)
Describe the bug
solidity-coverage is known to polyfill the contracts with loads of custom events used to measure test coverage. It seems that something done by them makes truffle-assertions not see the event.
Here's the error output:
Yeah, it's weird, there are two
PayInterest
events logged but they are somehow neglected. I suspect that truffle-assertions expects the event to be the second afterWithdrawFromStream
? Not sure.Example test code
The issue occurred in the sablier monorepo. Sorry, as of creating this issue, I have not yet pushed my local work on solidity-coverage. I'll come back here and make an update when I push to remote.
Here's how the test looks:
Expected behavior
The event should be filtered by truffle-assertions because it's definitely emitted.
Environment Information
Truffle version: 5.0.35 Web3 version: 1.2.1 truffle-assertions version: 0.8.2 ganache-cli version: 6.4.1 from https://github.com/frangio/ganache-cli (using this fork because OpenZeppelin uses it)