From e49072047f5aa94098ec1196938516cdc6c14560 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Fri, 17 Dec 2021 12:32:06 +0530 Subject: [PATCH] handle errors --- .../src/lib/solidity-unit-testing.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx index cb32b2fa4c..7dc60eebaf 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx +++ b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx @@ -346,9 +346,11 @@ export const SolidityUnitTesting = (props: any) => { for(const contract of contracts) { if(contract && contract !== 'summary') { runningTestFileName = cleanFileName(filename, contract) - const tests = fileTestsResult[contract] + const { tests, errors} = fileTestsResult[contract] if (tests?.length) { renderTests(tests, contract, filename) + } else if (errors) { + console.log('errors---->', errors) } else { // show only contract and file name const contractCard: any = ( @@ -384,11 +386,12 @@ export const SolidityUnitTesting = (props: any) => { testsResultByFilename[result.filename]['summary'] = {} } if(result.type === 'contract') { - testsResultByFilename[result.filename][result.value] = [] + testsResultByFilename[result.filename][result.value]= {} + testsResultByFilename[result.filename][result.value].tests = [] } else { // Set that this test is not rendered on UI result.rendered = false - testsResultByFilename[result.filename][result.context].push(result) + testsResultByFilename[result.filename][result.context]['tests'].push(result) } showTestsResult() } @@ -425,7 +428,9 @@ export const SolidityUnitTesting = (props: any) => { const testsSummary = { filename, passed: result.totalPassing, failed: result.totalFailing, timeTaken: totalTime, rendered: false } testsResultByFilename[filename]['summary']= testsSummary showTestsResult() - } + } else if (_errors) { + testsResultByFilename[filename]['errors'] = _errors + } // result.errors.forEach((error, index) => { // this.testSuite = error.context