Skip to content

Commit

Permalink
🛶 Extend regexp for new format of hardhat errors (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzadp authored Sep 16, 2022
1 parent 6f16299 commit 307f726
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-keys-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ethereum-waffle/chai": patch
---

🛶 Extend regexp for new format of hardhat errors
4 changes: 2 additions & 2 deletions waffle-chai/src/matchers/revertedWith.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ const decodeHardhatError = (error: any, context: any) => {
}
}
{
const regexp = new RegExp('reverted with reason string "(.*?)"');
const regexp = new RegExp('revert(ed)? with reason (string )?"(.*?)"');

const matches = regexp.exec(errorString);
if (matches && matches.length >= 1) {
return matches[1];
return matches[matches.length - 1];
}
}
return undefined;
Expand Down

0 comments on commit 307f726

Please sign in to comment.