Unverified Commit 312c6bd4 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1303 from ethereum/tests_with_worker

remix tests worked with compiler loaded using web-worker
parents b93b3577 a69f11be
...@@ -85,7 +85,7 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: ...@@ -85,7 +85,7 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
} }
} }
export function compileContractSources(sources: SrcIfc, importFileCb: any, opts: any, cb: Function) { export function compileContractSources(sources: SrcIfc, versionUrl: any, usingWorker: any, importFileCb: any, opts: any, cb: Function) {
let compiler, filepath: string let compiler, filepath: string
let accounts = opts.accounts || [] let accounts = opts.accounts || []
// Iterate over sources keys. Inject test libraries. Inject test library import statements. // Iterate over sources keys. Inject test libraries. Inject test library import statements.
...@@ -105,10 +105,11 @@ export function compileContractSources(sources: SrcIfc, importFileCb: any, opts: ...@@ -105,10 +105,11 @@ export function compileContractSources(sources: SrcIfc, importFileCb: any, opts:
async.waterfall([ async.waterfall([
function loadCompiler (next: Function) { function loadCompiler (next: Function) {
compiler = new RemixCompiler(importFileCb) compiler = new RemixCompiler(importFileCb)
compiler.onInternalCompilerLoaded() compiler.loadVersion(usingWorker, versionUrl)
// compiler.event.register('compilerLoaded', this, function (version) { // @ts-ignore
next() compiler.event.register('compilerLoaded', this, (version) => {
// }); next()
})
}, },
function doCompilation (next: Function) { function doCompilation (next: Function) {
// @ts-ignore // @ts-ignore
......
...@@ -18,7 +18,7 @@ const createWeb3Provider = async function () { ...@@ -18,7 +18,7 @@ const createWeb3Provider = async function () {
return web3 return web3
} }
export async function runTestSources(contractSources, testCallback, resultCallback, finalCallback, importFileCb, opts) { export async function runTestSources(contractSources, versionUrl, usingWorker, testCallback, resultCallback, finalCallback, importFileCb, opts) {
opts = opts || {} opts = opts || {}
let web3 = opts.web3 || await createWeb3Provider() let web3 = opts.web3 || await createWeb3Provider()
let accounts = opts.accounts || null let accounts = opts.accounts || null
...@@ -31,7 +31,7 @@ export async function runTestSources(contractSources, testCallback, resultCallba ...@@ -31,7 +31,7 @@ export async function runTestSources(contractSources, testCallback, resultCallba
}) })
}, },
function compile (next) { function compile (next) {
compileContractSources(contractSources, importFileCb, { accounts }, next) compileContractSources(contractSources, versionUrl, usingWorker, importFileCb, { accounts }, next)
}, },
function deployAllContracts (compilationResult, next) { function deployAllContracts (compilationResult, next) {
deployAll(compilationResult, web3, (err, contracts) => { deployAll(compilationResult, web3, (err, contracts) => {
......
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