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 87f67fdcf7..77a9cd1ee1 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 @@ -214,6 +214,24 @@ export const SolidityUnitTesting = (props: any) => { testTab.call('terminal', 'log', { type: 'info', value: finalLogs }) } + const highlightLocation = async (location: any, runningTests: any, fileName: any) => { + if (location) { + var split = location.split(':') + var file = split[2] + location = { + start: parseInt(split[0]), + length: parseInt(split[1]) + } + location = testTab.offsetToLineColumnConverter.offsetToLineColumnWithContent( + location, + parseInt(file), + runningTests[fileName].content + ) + await testTab.call('editor', 'discardHighlight') + await testTab.call('editor', 'highlight', location, fileName, '', { focus: true }) + } + } + const testCallback = (result: any, runningTests: any) => { console.log('result---in testCallback->', result) let debugBtn @@ -261,7 +279,7 @@ export const SolidityUnitTesting = (props: any) => { const testFailCard1: any = (
this.highlightLocation(result.location, runningTests, result.filename)} + onClick={() => highlightLocation(result.location, runningTests, result.filename)} >
✘ {result.value} @@ -278,7 +296,7 @@ export const SolidityUnitTesting = (props: any) => { const testFailCard2: any = (
this.highlightLocation(result.location, runningTests, result.filename)} + onClick={() => highlightLocation(result.location, runningTests, result.filename)} >
✘ {result.value}