debug tests e2e fixed

pull/5370/head
aniket-engg 3 years ago committed by Aniket
parent 8cbf8c879f
commit be40962acc
  1. 9
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -47,12 +47,13 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
let [runningTestsNumber, setRunningTestsNumber] = useState(0) // eslint-disable-line let [runningTestsNumber, setRunningTestsNumber] = useState(0) // eslint-disable-line
const hasBeenStopped = useRef(false) const hasBeenStopped = useRef(false)
const isDebugging = useRef(false)
const allTests: any = useRef([]) const allTests: any = useRef([])
const selectedTests: any = useRef([]) const selectedTests: any = useRef([])
const currentErrors: any = useRef([]) const currentErrors: any = useRef([])
let areTestsRunning = false let areTestsRunning = false
let isDebugging = false
let runningTestFileName: any let runningTestFileName: any
const filesContent: any = {} const filesContent: any = {}
@ -82,7 +83,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
} }
// if current file is changed while debugging and one of the files imported in test file are opened // if current file is changed while debugging and one of the files imported in test file are opened
// do not clear the test results in SUT plugin // do not clear the test results in SUT plugin
if (isDebugging && testTab.allFilesInvolved.includes(file)) return if (isDebugging.current && testTab.allFilesInvolved.includes(file)) return
allTests.current = [] allTests.current = []
updateTestFileList() updateTestFileList()
clearResults() clearResults()
@ -220,7 +221,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
} }
const startDebug = async (txHash: any, web3: any) => { const startDebug = async (txHash: any, web3: any) => {
isDebugging = true isDebugging.current = true
if (!await testTab.appManager.isActive('debugger')) await testTab.appManager.activatePlugin('debugger') if (!await testTab.appManager.isActive('debugger')) await testTab.appManager.activatePlugin('debugger')
testTab.call('menuicons', 'select', 'debugger') testTab.call('menuicons', 'select', 'debugger')
testTab.call('debugger', 'debug', txHash, web3) testTab.call('debugger', 'debug', txHash, web3)
@ -501,7 +502,7 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
} }
const runTest = (testFilePath: any, callback: any) => { const runTest = (testFilePath: any, callback: any) => {
isDebugging = false isDebugging.current = false
if (hasBeenStopped.current) { if (hasBeenStopped.current) {
updateFinalResult(null, null, null) updateFinalResult(null, null, null)
return return

Loading…
Cancel
Save