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
}
// 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
*/

@ -153,8 +153,15 @@ module.exports = class TestTab extends ViewPlugin {
return new Promise((resolve, reject) => {
let runningTest = {}
runningTest[path] = { content }
let currentCompilerUrl = this.baseurl + '/' + this.compileTab.getCurrentVersion()
remixTests.runTestSources(runningTest, currentCompilerUrl, canUseWorker(this.compileTab.getCurrentVersion()), () => {}, () => {}, (error, result) => {
const {currentVersion, evmVersion, optimize} = this.compileTab.getCurrentCompilerConfig()
const currentCompilerUrl = this.baseurl + '/' + currentVersion
const compilerConfig = {
currentCompilerUrl,
evmVersion,
optimize,
usingWorker: canUseWorker(currentVersion)
}
remixTests.runTestSources(runningTest, compilerConfig, () => {}, () => {}, (error, result) => {
if (error) return reject(error)
resolve(result)
}, (url, cb) => {
@ -166,13 +173,19 @@ module.exports = class TestTab extends ViewPlugin {
runTest (testFilePath, callback) {
this.loading.hidden = false
this.fileManager.getFile(testFilePath).then((content) => {
var runningTest = {}
let runningTest = {}
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(
runningTest,
currentCompilerUrl,
canUseWorker(this.compileTab.getCurrentVersion()),
compilerConfig,
(result) => this.testCallback(result),
(_err, result, cb) => this.resultsCallback(_err, result, cb),
(error, result) => {

Loading…
Cancel
Save