openzeppelin-test-helpers icon indicating copy to clipboard operation
openzeppelin-test-helpers copied to clipboard

Fix expectRevert accepting partial matches

Open Philogy opened this issue 4 years ago • 0 comments

The bug caused tests using expectRevert to pass despite the revertReason not fully being correct because of the use of String.prototype.indexOf to verify if the correct revert reason was contained in the error string. To fix it more robust error parsing logic was added; it is compatible with both old and new VM Exception strings.

Discovered this bug in my personal project, tests were passing despite the revert messages not fully being identical.

Philogy avatar Jan 18 '21 15:01 Philogy