Commit 7db7b758 authored by Aniket-Engg's avatar Aniket-Engg Committed by Liana Husikyan

pass compiler configuration to remix-tests

parent 9d6d6c98
...@@ -200,6 +200,15 @@ class CompileTab extends ViewPlugin { ...@@ -200,6 +200,15 @@ class CompileTab extends ViewPlugin {
return this.compilerContainer.data.selectedVersion return this.compilerContainer.data.selectedVersion
} }
// This function is used for passing the compiler configuration to 'remix-tests'
getCurrentCompilerConfig () {
return {
currentVersion: this.compilerContainer.data.selectedVersion,
evmVersion: this.compileTabLogic.evmVersion,
optimize: this.compileTabLogic.optimize
}
}
/********* /*********
* SUB-COMPONENTS * SUB-COMPONENTS
*/ */
......
...@@ -153,8 +153,15 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -153,8 +153,15 @@ module.exports = class TestTab extends ViewPlugin {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let runningTest = {} let runningTest = {}
runningTest[path] = { content } runningTest[path] = { content }
let currentCompilerUrl = this.baseurl + '/' + this.compileTab.getCurrentVersion() const {currentVersion, evmVersion, optimize} = this.compileTab.getCurrentCompilerConfig()
remixTests.runTestSources(runningTest, currentCompilerUrl, canUseWorker(this.compileTab.getCurrentVersion()), () => {}, () => {}, (error, result) => { const currentCompilerUrl = this.baseurl + '/' + currentVersion
const compilerConfig = {
currentCompilerUrl,
evmVersion,
optimize,
usingWorker: canUseWorker(currentVersion)
}
remixTests.runTestSources(runningTest, compilerConfig, () => {}, () => {}, (error, result) => {
if (error) return reject(error) if (error) return reject(error)
resolve(result) resolve(result)
}, (url, cb) => { }, (url, cb) => {
...@@ -166,13 +173,19 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -166,13 +173,19 @@ module.exports = class TestTab extends ViewPlugin {
runTest (testFilePath, callback) { runTest (testFilePath, callback) {
this.loading.hidden = false this.loading.hidden = false
this.fileManager.getFile(testFilePath).then((content) => { this.fileManager.getFile(testFilePath).then((content) => {
var runningTest = {} let runningTest = {}
runningTest[testFilePath] = { content } runningTest[testFilePath] = { content }
let currentCompilerUrl = this.baseurl + '/' + this.compileTab.getCurrentVersion() const {currentVersion, evmVersion, optimize} = this.compileTab.getCurrentCompilerConfig()
const currentCompilerUrl = this.baseurl + '/' + currentVersion
const compilerConfig = {
currentCompilerUrl,
evmVersion,
optimize,
usingWorker: canUseWorker(currentVersion)
}
remixTests.runTestSources( remixTests.runTestSources(
runningTest, runningTest,
currentCompilerUrl, compilerConfig,
canUseWorker(this.compileTab.getCurrentVersion()),
(result) => this.testCallback(result), (result) => this.testCallback(result),
(_err, result, cb) => this.resultsCallback(_err, result, cb), (_err, result, cb) => this.resultsCallback(_err, result, cb),
(error, result) => { (error, result) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment