button improved

pull/1573/head
aniket-engg 3 years ago committed by Aniket
parent 52b2e4686d
commit e7b55b6a10
  1. 27
      apps/remix-ide/src/app/tabs/test-tab.js
  2. 4
      libs/remix-tests/src/runTestSources.ts

@ -201,11 +201,10 @@ module.exports = class TestTab extends ViewPlugin {
}
}
async startDebug (result) {
const txHash = JSON.parse(result.errMsg.replace('Transaction has been reverted by the EVM:', '')).transactionHash
async startDebug (txHash, web3) {
if (!await this.appManager.isActive('debugger')) await this.appManager.activatePlugin('debugger')
this.call('menuicons', 'select', 'debugger')
this.call('debugger', 'debug', txHash, result.web3)
this.call('debugger', 'debug', txHash, web3)
}
printHHLogs (logsArr, testName) {
@ -258,6 +257,20 @@ module.exports = class TestTab extends ViewPlugin {
} 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`<div
class="btn border btn btn-sm ml-1"
title="Start debugging"
onclick=${() => this.startDebug(txHash, web3)}
>
<i class="fas fa-bug"></i>
</div>`
debugBtn.style.visibility = 'visible'
debugBtn.style.cursor = 'pointer'
} else debugBtn.style.visibility = 'hidden'
this.testsOutput.appendChild(yo`
<div
class="bg-light mb-2 px-2 ${css.testLog} d-flex flex-column text-danger border-0"
@ -266,13 +279,7 @@ module.exports = class TestTab extends ViewPlugin {
>
<div class="d-flex my-1 align-items-start justify-content-between">
<span> ${result.value}</span>
<div
class="btn border btn btn-sm ml-1"
title="Start debugging"
onclick=${() => this.startDebug(result)}
>
<i class="fas fa-bug"></i>
</div>
${debugBtn}
</div>
<span class="text-dark">Error Message:</span>
<span class="pb-2 text-break">"${result.errMsg}"</span>

@ -16,7 +16,7 @@ require('colors')
export class UnitTestRunner {
event
constructor() {
constructor () {
this.event = new EventManager()
}
@ -53,7 +53,7 @@ export class UnitTestRunner {
})
},
(next) => {
compileContractSources(contractSources, compilerConfig, importFileCb, { accounts, event: this.event}, next)
compileContractSources(contractSources, compilerConfig, importFileCb, { accounts, event: this.event }, next)
},
function deployAllContracts (compilationResult: compilationInterface, asts: ASTInterface, next) {
for (const filename in asts) {

Loading…
Cancel
Save