|
|
@ -135,12 +135,24 @@ module.exports = class TestTab extends ViewPlugin { |
|
|
|
}
|
|
|
|
}
|
|
|
|
this.rawFileName = result.filename |
|
|
|
this.rawFileName = result.filename |
|
|
|
this.runningTestFileName = this.cleanFileName(this.rawFileName, this.testSuite) |
|
|
|
this.runningTestFileName = this.cleanFileName(this.rawFileName, this.testSuite) |
|
|
|
this.outputHeader = yo`<div id="${this.runningTestFileName}" class="${css.outputTitle}">${this.testSuite} <br /> ${this.rawFileName}</div>` |
|
|
|
this.outputHeader = yo` |
|
|
|
|
|
|
|
<div id="${this.runningTestFileName}" class="${css.outputTitle}"> |
|
|
|
|
|
|
|
${this.testSuite} <br /> ${this.rawFileName} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
` |
|
|
|
this.testsOutput.appendChild(this.outputHeader) |
|
|
|
this.testsOutput.appendChild(this.outputHeader) |
|
|
|
} else if (result.type === 'testPass') { |
|
|
|
} else if (result.type === 'testPass') { |
|
|
|
this.testsOutput.appendChild(yo`<div class="${css.testPass} ${css.testLog} alert-success bg-transparent border-0">✓ ${result.value}</div>`) |
|
|
|
this.testsOutput.appendChild(yo` |
|
|
|
|
|
|
|
<div class="${css.testPass} ${css.testLog} alert-success bg-transparent border-0"> |
|
|
|
|
|
|
|
✓ ${result.value} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} else if (result.type === 'testFailure') { |
|
|
|
} else if (result.type === 'testFailure') { |
|
|
|
this.testsOutput.appendChild(yo`<div class="${css.testFailure} ${css.testLog} alert-danger bg-transparent border-0">✘ ${result.value}</div>`) |
|
|
|
this.testsOutput.appendChild(yo` |
|
|
|
|
|
|
|
<div class="${css.testFailure} ${css.testLog} alert-danger bg-transparent border-0"> |
|
|
|
|
|
|
|
✘ ${result.value} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -149,9 +161,6 @@ module.exports = class TestTab extends ViewPlugin { |
|
|
|
// result.passingNum
|
|
|
|
// result.passingNum
|
|
|
|
// result.failureNum
|
|
|
|
// result.failureNum
|
|
|
|
// result.timePassed
|
|
|
|
// result.timePassed
|
|
|
|
if (!_err) { |
|
|
|
|
|
|
|
this.testsOutput |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cb() |
|
|
|
cb() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -161,13 +170,29 @@ module.exports = class TestTab extends ViewPlugin { |
|
|
|
|
|
|
|
|
|
|
|
setHeader (status) { |
|
|
|
setHeader (status) { |
|
|
|
if (status) { |
|
|
|
if (status) { |
|
|
|
const label = yo`<div class="alert-success d-inline-block mb-1 mr-1 p-1 passed_${this.runningTestFileName}">PASS</div>` |
|
|
|
const label = yo` |
|
|
|
|
|
|
|
<div class="alert-success d-inline-block mb-1 mr-1 p-1 passed_${this.runningTestFileName}"> |
|
|
|
|
|
|
|
PASS |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
this.outputHeader && yo.update(this.outputHeader, yo`<div id="${this.runningTestFileName}" class="${css.outputTitle}">${label} ${this.testSuite} <br /> ${this.rawFileName}</div>`) |
|
|
|
this.outputHeader && yo.update(this.outputHeader, yo` |
|
|
|
|
|
|
|
<div id="${this.runningTestFileName}" class="${css.outputTitle}"> |
|
|
|
|
|
|
|
${label} ${this.testSuite} <br/> ${this.rawFileName} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const label = yo`<div class="alert-danger d-inline-block mb-1 mr-1 p-1 failed_${this.runningTestFileName}">FAIL</div>` |
|
|
|
const label = yo` |
|
|
|
|
|
|
|
<div class="alert-danger d-inline-block mb-1 mr-1 p-1 failed_${this.runningTestFileName}"> |
|
|
|
|
|
|
|
FAIL |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
this.outputHeader && yo.update(this.outputHeader, yo`<div id="${this.runningTestFileName}" class="${css.outputTitle}">${label} ${this.testSuite} <br /> ${this.rawFileName}</div>`) |
|
|
|
this.outputHeader && yo.update(this.outputHeader, yo` |
|
|
|
|
|
|
|
<div id="${this.runningTestFileName}" class="${css.outputTitle}"> |
|
|
|
|
|
|
|
${label} ${this.testSuite} <br/> ${this.rawFileName} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -189,11 +214,25 @@ module.exports = class TestTab extends ViewPlugin { |
|
|
|
yo.update(this.resultStatistics, this.createResultLabel()) |
|
|
|
yo.update(this.resultStatistics, this.createResultLabel()) |
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
if (result.totalPassing > 0 && result.totalFailing > 0) { |
|
|
|
if (result.totalPassing > 0 && result.totalFailing > 0) { |
|
|
|
this.testsOutput.appendChild(yo`<div class="text-success">${result.totalPassing} passing, <span class="text-danger"> ${result.totalFailing} failing </span> (${result.totalTime}s)</div>`) |
|
|
|
this.testsOutput.appendChild(yo` |
|
|
|
|
|
|
|
<div class="text-success"> |
|
|
|
|
|
|
|
${result.totalPassing} passing,
|
|
|
|
|
|
|
|
<span class="text-danger"> ${result.totalFailing} failing </span> |
|
|
|
|
|
|
|
(${result.totalTime}s) |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} else if (result.totalPassing > 0 && result.totalFailing <= 0) { |
|
|
|
} else if (result.totalPassing > 0 && result.totalFailing <= 0) { |
|
|
|
this.testsOutput.appendChild(yo`<div class="text-success">${result.totalPassing} passing (${result.totalTime}s)</div>`) |
|
|
|
this.testsOutput.appendChild(yo` |
|
|
|
|
|
|
|
<div class="text-success"> |
|
|
|
|
|
|
|
${result.totalPassing} passing (${result.totalTime}s) |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} else if (result.totalPassing <= 0 && result.totalFailing > 0) { |
|
|
|
} else if (result.totalPassing <= 0 && result.totalFailing > 0) { |
|
|
|
this.testsOutput.appendChild(yo`<div class="text-danger">${result.totalFailing} failing</div>`) |
|
|
|
this.testsOutput.appendChild(yo` |
|
|
|
|
|
|
|
<div class="text-danger"> |
|
|
|
|
|
|
|
${result.totalFailing} failing |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} |
|
|
|
} |
|
|
|
//fix for displaying right label for multiple tests (testsuites) in a single file
|
|
|
|
//fix for displaying right label for multiple tests (testsuites) in a single file
|
|
|
|
this.testSuites.forEach(testSuite => { |
|
|
|
this.testSuites.forEach(testSuite => { |
|
|
@ -212,18 +251,23 @@ module.exports = class TestTab extends ViewPlugin { |
|
|
|
|
|
|
|
|
|
|
|
if (!isFailingLabel) this.setHeader(false) |
|
|
|
if (!isFailingLabel) this.setHeader(false) |
|
|
|
displayError.appendChild(yo` |
|
|
|
displayError.appendChild(yo` |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<ul class="ml-3 mb-0"> |
|
|
|
<ul class="ml-3 mb-0"> |
|
|
|
<li>${error.value} </li> |
|
|
|
<li>${error.value} </li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
<span class="text-danger ml-3">${error.message}</span> |
|
|
|
<span class="text-danger ml-3">${error.message}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
`)
|
|
|
|
`)
|
|
|
|
}) |
|
|
|
}) |
|
|
|
if (result.errors && result.errors.length > 0) { |
|
|
|
if (result.errors && result.errors.length > 0) { |
|
|
|
this.testsOutput.appendChild(displayError) |
|
|
|
this.testsOutput.appendChild(displayError) |
|
|
|
} |
|
|
|
} |
|
|
|
this.testsOutput.appendChild(yo`<div><br /><p class="text-info border-top m-0"></p></div>`) |
|
|
|
this.testsOutput.appendChild(yo` |
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
<p class="text-info border-top m-0"></p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
`)
|
|
|
|
} |
|
|
|
} |
|
|
|
if (this.hasBeenStopped && (this.readyTestsNumber !== this.runningTestsNumber)) { |
|
|
|
if (this.hasBeenStopped && (this.readyTestsNumber !== this.runningTestsNumber)) { |
|
|
|
// if all tests has been through before stopping no need to print this.
|
|
|
|
// if all tests has been through before stopping no need to print this.
|
|
|
@ -438,7 +482,7 @@ module.exports = class TestTab extends ViewPlugin { |
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
|
this.onActivationInternal() |
|
|
|
this.onActivationInternal() |
|
|
|
this.testsOutput = yo`<div class="mx-3 mb-2 border-top border-primary" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></a>` |
|
|
|
this.testsOutput = yo`<div class="mx-3 mb-2 pb-2 border-top border-primary" hidden='true' id="solidityUnittestsOutput" data-id="testTabSolidityUnitTestsOutput"></a>` |
|
|
|
this.testsExecutionStopped = yo`<label class="text-warning h6">The test execution has been stopped</label>` |
|
|
|
this.testsExecutionStopped = yo`<label class="text-warning h6">The test execution has been stopped</label>` |
|
|
|
this.testsExecutionStopped.hidden = true |
|
|
|
this.testsExecutionStopped.hidden = true |
|
|
|
this.resultStatistics = this.createResultLabel() |
|
|
|
this.resultStatistics = this.createResultLabel() |
|
|
|