From f72b189ed2d9429b493391f9a55e4b05f8974f4d Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 24 Oct 2023 14:26:39 +0200 Subject: [PATCH] fix solidity unittest, listen on failed tx --- libs/remix-tests/src/testRunner.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-tests/src/testRunner.ts b/libs/remix-tests/src/testRunner.ts index fa27f2d738..b243d386f8 100644 --- a/libs/remix-tests/src/testRunner.ts +++ b/libs/remix-tests/src/testRunner.ts @@ -214,6 +214,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com let passingNum = 0 let failureNum = 0 let timePassed = 0 + const failedTransactions = {} const isJSONInterfaceAvailable = testObject && testObject.options && testObject.options.jsonInterface if (!isJSONInterfaceAvailable) { return resultsCallback(new Error('Contract interface not available'), { passingNum, failureNum, timePassed }) } const runList: RunListInterface[] = createRunList(testObject.options.jsonInterface, fileAST, testName) @@ -378,6 +379,8 @@ export function runTest (testName: string, testObject: any, contractDetails: Com } }).on('error', async (err) => { const time: number = (Date.now() - startTime) / 1000.0 + if (failedTransactions[err.receipt.transactionHash]) return // we are already aware of this transaction failing. + failedTransactions[err.receipt.transactionHash] = time let errMsg = err.message let txHash if (err.reason) errMsg = `transaction reverted with the reason: ${err.reason}`