diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 277abab11d..9e2459d7ac 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -247,6 +247,14 @@ module.exports = class TestTab extends ViewPlugin { testCallback (result, runningTests) { this.testsOutput.hidden = false + let debugBtn = yo`` + if((result.type === 'testPass' || result.type === 'testFailure') && result.debugTxHash) { + const { web3, debugTxHash } = result + debugBtn = yo `
this.startDebug(debugTxHash, web3)}> + +
` + debugBtn.style.cursor = 'pointer' + } if (result.type === 'contract') { this.testSuite = result.value if (this.testSuites) { @@ -271,26 +279,15 @@ module.exports = class TestTab extends ViewPlugin { class="${css.testPass} ${css.testLog} bg-light mb-2 text-success border-0" onclick=${() => this.discardHighlight()} > - ✓ ${result.value} +
+ ✓ ${result.value} + ${debugBtn} +
`) } else if (result.type === 'testFailure') { if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value) if (!result.assertMethod) { - let debugBtn = yo`` - if (result.errMsg.includes('Transaction has been reverted by the EVM')) { - const txHash = JSON.parse(result.errMsg.replace('Transaction has been reverted by the EVM:', '')).transactionHash - const { web3 } = result - debugBtn = yo`
this.startDebug(txHash, web3)} - > - -
` - debugBtn.style.visibility = 'visible' - debugBtn.style.cursor = 'pointer' - } else debugBtn.style.visibility = 'hidden' this.testsOutput.appendChild(yo`
this.highlightLocation(result.location, runningTests, result.filename)} > - ✘ ${result.value} +
+ ✘ ${result.value} + ${debugBtn} +
Error Message: "${result.errMsg}" Assertion: