From 61e52d8841cac8abdfcd8d4df538b8d69e8e23e1 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Sun, 26 Apr 2020 19:33:51 +0000 Subject: [PATCH] Added label to test output --- src/app/tabs/test-tab.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 313ac1c6f0..58de45c173 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -125,13 +125,28 @@ module.exports = class TestTab extends ViewPlugin { } testCallback (result) { + const hasFailingLabel = document.querySelector(`.failed_${this.runningTestFileName}`) + const hasPassingLabel = document.querySelector(`.passed_${this.runningTestFileName}`) + this.testsOutput.hidden = false if (result.type === 'contract') { - this.testsOutput.appendChild(yo`
${result.filename} (${result.value})
`) + this.runningTestFileName = this.cleanFileName(result.filename) + this.outputHeader = yo`
${result.value}
${result.filename}
` + this.testsOutput.appendChild(this.outputHeader) } else if (result.type === 'testPass') { this.testsOutput.appendChild(yo`
✓ ${result.value}
`) + if(!hasFailingLabel && !hasPassingLabel) { + const label = yo`PASS` + + this.outputHeader && yo.update(this.outputHeader, yo`
${label} ${result.context}
${result.filename}
`) + } } else if (result.type === 'testFailure') { this.testsOutput.appendChild(yo`
✘ ${result.value}
`) + if(!hasFailingLabel) { + const label = yo`FAIL` + + this.outputHeader && yo.update(this.outputHeader, yo`
${label} ${result.context}
${result.filename}
`) + } } } @@ -141,9 +156,16 @@ module.exports = class TestTab extends ViewPlugin { // result.failureNum // result.timePassed this.testsSummary.hidden = false + if (!_err) { + this.testsOutput + } cb() } + cleanFileName (fileName) { + return fileName ? fileName.replace(/\//g, '_').replace(/\./g, '_') : fileName + } + updateFinalResult (_errors, result, filename) { this.testsSummary.hidden = false ++this.readyTestsNumber