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 aa654bb0ba..3791a1e5e6 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 @@ -61,8 +61,7 @@ export const SolidityUnitTesting = (props: any) => { console.log('clearResults--->') // yo.update(this.resultStatistics, yo``) testTab.call('editor', 'clearAnnotations') - // this.testsOutput.innerHTML = '' - // this.testsOutput.hidden = true + setTestsOutput([]) setTestsExecutionStoppedHidden(true) setTestsExecutionStoppedErrorHidden(true) } @@ -228,53 +227,53 @@ export const SolidityUnitTesting = (props: any) => { ) setTestsOutput(prevCards => ([...prevCards, testPassCard])) + } else if (result.type === 'testFailure') { + // if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value) + if (!result.assertMethod) { + const testFailCard: any = (
this.highlightLocation(result.location, runningTests, result.filename)} + > +
+ ✘ {result.value} + {/* ${debugBtn} */} +
+ Error Message: + "{result.errMsg}" +
) + setTestsOutput(prevCards => ([...prevCards, testFailCard])) + } + // else { + // const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : '' + // const method = result.assertMethod === 'ok' ? '' : result.assertMethod + // const expected = result.assertMethod === 'ok' ? '\'true\'' : result.expected + // this.testsOutput.appendChild(yo` + //
this.highlightLocation(result.location, runningTests, result.filename)} + // > + //
+ // ✘ ${result.value} + // ${debugBtn} + //
+ // Error Message: + // "${result.errMsg}" + // Assertion: + //
+ // Expected value should be + //
${method}
+ //
${preposition} ${expected}
+ //
+ // Received value: + // ${result.returned} + // Skipping the remaining tests of the function. + //
+ // `) + // } } - //else if (result.type === 'testFailure') { - // if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value) - // if (!result.assertMethod) { - // this.testsOutput.appendChild(yo` - //
this.highlightLocation(result.location, runningTests, result.filename)} - // > - //
- // ✘ ${result.value} - // ${debugBtn} - //
- // Error Message: - // "${result.errMsg}" - //
- // `) - // } else { - // const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : '' - // const method = result.assertMethod === 'ok' ? '' : result.assertMethod - // const expected = result.assertMethod === 'ok' ? '\'true\'' : result.expected - // this.testsOutput.appendChild(yo` - //
this.highlightLocation(result.location, runningTests, result.filename)} - // > - //
- // ✘ ${result.value} - // ${debugBtn} - //
- // Error Message: - // "${result.errMsg}" - // Assertion: - //
- // Expected value should be - //
${method}
- //
${preposition} ${expected}
- //
- // Received value: - // ${result.returned} - // Skipping the remaining tests of the function. - //
- // `) - // } - // } else if (result.type === 'logOnly') { + //else if (result.type === 'logOnly') { // if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value) // } }