diff --git a/src/testRunner.js b/src/testRunner.js index c83c989697..94c0d53dde 100644 --- a/src/testRunner.js +++ b/src/testRunner.js @@ -59,37 +59,27 @@ function runTest (testName, testObject, testCallback, resultsCallback) { method.send().on('receipt', function (receipt) { try { let time = Math.ceil((Date.now() - startTime) / 1000.0) - // if (func.type === 'test') { let topic = Web3.utils.sha3('AssertionEvent(bool,string)') - let matchingEvents = [] for (let i in receipt.events) { let event = receipt.events[i] if (event.raw.topics.indexOf(topic) >= 0) { - matchingEvents.push(web3.eth.abi.decodeParameters(['bool', 'string'], event.raw.data)) + var testEvent = web3.eth.abi.decodeParameters(['bool', 'string'], event.raw.data) + if (testEvent[0]) { + testCallback({type: 'testPass', value: changeCase.sentenceCase(func.name), time: time, context: testName}) + passingNum += 1 + } else { + testCallback({type: 'testFailure', value: changeCase.sentenceCase(func.name), time: time, errMsg: testEvent[1], context: testName}) + failureNum += 1 + } } } - - if (matchingEvents.length === 0) { - return next() - } - - let result = matchingEvents[0] - - if (result[0]) { - testCallback({type: 'testPass', value: changeCase.sentenceCase(func.name), time: time, context: testName}) - passingNum += 1 - } else { - testCallback({type: 'testFailure', value: changeCase.sentenceCase(func.name), time: time, errMsg: result[1], context: testName}) - failureNum += 1 - } - // } + return next() } catch (err) { console.log('error!') console.dir(err) return next(err) } - next() }).on('error', function (err) { next(err) })