From dc5b82d5c942ff54c4ebc4fb20d1f5b798c63e7a Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Fri, 27 Sep 2019 15:26:44 +0530 Subject: [PATCH] test compiler load using worker --- src/app/tabs/compile-tab.js | 5 +++++ src/app/tabs/test-tab.js | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index b24f428fb8..ededb6d5f2 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -191,6 +191,11 @@ class CompileTab extends ViewPlugin { return this.compileTabLogic.compileFile(fileName) } + // This function is used for passing the compiler remix-tests + getCurrentVersion () { + return this.compilerContainer.data.selectedVersion + } + /********* * SUB-COMPONENTS */ diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 9c106f88d7..968a09e301 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -28,6 +28,7 @@ module.exports = class TestTab extends ViewPlugin { this.data = {} this.appManager = appManager this.renderer = renderer + this.baseurl = 'https://solc-bin.ethereum.org/bin' appManager.event.on('activate', (name) => { if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) }) @@ -151,7 +152,9 @@ module.exports = class TestTab extends ViewPlugin { return new Promise((resolve, reject) => { let runningTest = {} runningTest[path] = { content } - remixTests.runTestSources(runningTest, () => {}, () => {}, (error, result) => { + let currentCompilerUrl = this.baseurl + '/' + this.compileTab.getCurrentVersion() + let usingWorker = this.compileTab.compilerContainer.browserSupportWorker() + remixTests.runTestSources(runningTest, currentCompilerUrl, usingWorker, () => {}, () => {}, (error, result) => { if (error) return reject(error) resolve(result) }, (url, cb) => { @@ -165,7 +168,9 @@ module.exports = class TestTab extends ViewPlugin { this.fileManager.getFile(testFilePath).then((content) => { var runningTest = {} runningTest[testFilePath] = { content } - remixTests.runTestSources(runningTest, (result) => { this.testCallback(result) }, (_err, result, cb) => { this.resultsCallback(_err, result, cb) }, (error, result) => { + let currentCompilerUrl = this.baseurl + '/' + this.compileTab.getCurrentVersion() + let usingWorker = this.compileTab.compilerContainer.browserSupportWorker() + remixTests.runTestSources(runningTest, currentCompilerUrl, usingWorker, (result) => { this.testCallback(result) }, (_err, result, cb) => { this.resultsCallback(_err, result, cb) }, (error, result) => { this.updateFinalResult(error, result, testFilePath) this.loading.hidden = true callback(error)