pass compiler configuration to remix-tests

pull/1/head
Aniket-Engg 5 years ago committed by Liana Husikyan
parent 9d6d6c98b1
commit 7db7b758bc
  1. 9
      src/app/tabs/compile-tab.js
  2. 25
      src/app/tabs/test-tab.js

@ -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 {
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 {
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) => {

Loading…
Cancel
Save