-
Notifications
You must be signed in to change notification settings - Fork 133
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
ExpectRevert is unable to correctly identify revert messages #128
Comments
Hi @EuanHay! I’m sorry that you had this issue. We would need more information so that we can reproduce it. Can you provide how you are testing (Truffle or OpenZeppelin Test Environment), and a snippet of your test? Any other details that might help us reproduce it would be appreciated! I only get the error using OpenZeppelin Test Environment when I don't try to catch the revert using expectRevert, see my test below. For usage, please see the API documentation: https://docs.openzeppelin.com/test-helpers/0.5/api#expect-revert MyContract.sol// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract MyContract {
uint256 private value;
function doStuff() public {
require(false, "Item does not exist, cannot update Item");
}
} MyContract.test.js
Testing
|
the example you provided indeed results in |
In the expectRevert function, the error message I provided is identical to the error message expected by the expectRevert function. expectRevert is unable to see the error given is in fact correct.
Error: Returned error: VM Exception while processing transaction: revert Item does not exist, cannot update Item -- Reason given: Item does not exist, cannot update Item.
Any ideas on how to resolve this?
The text was updated successfully, but these errors were encountered: