handle errors

pull/1862/head
Aniket-Engg 3 years ago committed by Aniket
parent 94a898c53c
commit e49072047f
  1. 13
      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) { for(const contract of contracts) {
if(contract && contract !== 'summary') { if(contract && contract !== 'summary') {
runningTestFileName = cleanFileName(filename, contract) runningTestFileName = cleanFileName(filename, contract)
const tests = fileTestsResult[contract] const { tests, errors} = fileTestsResult[contract]
if (tests?.length) { if (tests?.length) {
renderTests(tests, contract, filename) renderTests(tests, contract, filename)
} else if (errors) {
console.log('errors---->', errors)
} else { } else {
// show only contract and file name // show only contract and file name
const contractCard: any = ( const contractCard: any = (
@ -384,11 +386,12 @@ export const SolidityUnitTesting = (props: any) => {
testsResultByFilename[result.filename]['summary'] = {} testsResultByFilename[result.filename]['summary'] = {}
} }
if(result.type === 'contract') { if(result.type === 'contract') {
testsResultByFilename[result.filename][result.value] = [] testsResultByFilename[result.filename][result.value]= {}
testsResultByFilename[result.filename][result.value].tests = []
} else { } else {
// Set that this test is not rendered on UI // Set that this test is not rendered on UI
result.rendered = false result.rendered = false
testsResultByFilename[result.filename][result.context].push(result) testsResultByFilename[result.filename][result.context]['tests'].push(result)
} }
showTestsResult() showTestsResult()
} }
@ -425,7 +428,9 @@ export const SolidityUnitTesting = (props: any) => {
const testsSummary = { filename, passed: result.totalPassing, failed: result.totalFailing, timeTaken: totalTime, rendered: false } const testsSummary = { filename, passed: result.totalPassing, failed: result.totalFailing, timeTaken: totalTime, rendered: false }
testsResultByFilename[filename]['summary']= testsSummary testsResultByFilename[filename]['summary']= testsSummary
showTestsResult() showTestsResult()
} } else if (_errors) {
testsResultByFilename[filename]['errors'] = _errors
}
// result.errors.forEach((error, index) => { // result.errors.forEach((error, index) => {
// this.testSuite = error.context // this.testSuite = error.context

Loading…
Cancel
Save