Skip to content

Commit 307f726

Browse files
authored
🛶 Extend regexp for new format of hardhat errors (#793)
1 parent 6f16299 commit 307f726

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎.changeset/perfect-keys-peel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ethereum-waffle/chai": patch
3+
---
4+
5+
🛶 Extend regexp for new format of hardhat errors

‎waffle-chai/src/matchers/revertedWith.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ const decodeHardhatError = (error: any, context: any) => {
8686
}
8787
}
8888
{
89-
const regexp = new RegExp('reverted with reason string "(.*?)"');
89+
const regexp = new RegExp('revert(ed)? with reason (string )?"(.*?)"');
9090

9191
const matches = regexp.exec(errorString);
9292
if (matches && matches.length >= 1) {
93-
return matches[1];
93+
return matches[matches.length - 1];
9494
}
9595
}
9696
return undefined;

0 commit comments

Comments
 (0)