fix solidity unittest, listen on failed tx

pull/5370/head
yann300 1 year ago
parent b2c66bada2
commit f72b189ed2
  1. 3
      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}`

Loading…
Cancel
Save