Fixed false positives in expectTransactionFailedAsync
This commit is contained in:
parent
b2cf701e30
commit
56bc2944d0
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.1.8",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Fixed false positives in `expectTransactionFailedAsync` and `expectContractCallFailedAsync`",
|
||||||
|
"pr": 1852
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1558712885,
|
"timestamp": 1558712885,
|
||||||
"version": "3.1.7",
|
"version": "3.1.7",
|
||||||
|
@ -104,7 +104,8 @@ export async function expectTransactionFailedAsync(p: sendTransactionResult, rea
|
|||||||
}
|
}
|
||||||
switch (nodeType) {
|
switch (nodeType) {
|
||||||
case NodeType.Ganache:
|
case NodeType.Ganache:
|
||||||
return expect(p).to.be.rejectedWith(reason);
|
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
|
||||||
|
return expect(p).to.be.rejectedWith(rejectionMessageRegex);
|
||||||
case NodeType.Geth:
|
case NodeType.Geth:
|
||||||
logUtils.warn(
|
logUtils.warn(
|
||||||
'WARNING: Geth does not support revert reasons for sendTransaction. This test will pass if the transaction fails for any reason.',
|
'WARNING: Geth does not support revert reasons for sendTransaction. This test will pass if the transaction fails for any reason.',
|
||||||
@ -160,7 +161,8 @@ export async function expectTransactionFailedWithoutReasonAsync(p: sendTransacti
|
|||||||
* otherwise resolve with no value.
|
* otherwise resolve with no value.
|
||||||
*/
|
*/
|
||||||
export async function expectContractCallFailedAsync<T>(p: Promise<T>, reason: RevertReason): Promise<void> {
|
export async function expectContractCallFailedAsync<T>(p: Promise<T>, reason: RevertReason): Promise<void> {
|
||||||
return expect(p).to.be.rejectedWith(reason);
|
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
|
||||||
|
return expect(p).to.be.rejectedWith(rejectionMessageRegex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user