Using emit().withArgs with multiple events, only asserts the value of the arguments of the last event
I'm using @nomiclabs/hardhat-waffle": "^2.0.3" with "ethereum-waffle": "^3.4.4",
When try to assert the events parameters using emit().withArgs it does correcttly check that ALL events has been emitted and the arguments has the correct types. But only checks the value of the arguments of the last event!
Exmaple:
await expect(bridgeContract.bridge(wrappedTokenAddress, newDestinationNetwork, destinationAddress, amount))
.to.emit(bridgeContract, 'BridgeEvent')
.withArgs("This is bytes i can put whathever and the test will pass anyway ^^") // This is NOT checked
.to.emit(newWrappedToken, 'Transfer')
.withArgs(deployer.address, ethers.constants.AddressZero, amount); // This is checked
@invocamanman We did a bunch of work related to this in the new Waffle 4 alpha - so it is pending, or you could use the @alpha tag to try it out.
great! thank you so much! @rzadp
@invocamanman I just spent an hour debugging why my test passed
Waffle 4 is out now, feel free to open new issue if things are not working quite right in 4.