Skip to content

Commit

Permalink
fix solidity unittest, listen on failed tx
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Oct 24, 2023
1 parent 8d21261 commit c729fe1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/remix-tests/src/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}`
Expand Down

0 comments on commit c729fe1

Please sign in to comment.