Merge pull request #1303 from ethereum/tests_with_worker

remix tests worked with compiler loaded using web-worker
pull/7/head
yann300 5 years ago committed by GitHub
commit 312c6bd44c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      remix-tests/src/compiler.ts
  2. 4
      remix-tests/src/runTestSources.ts

@ -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 accounts = opts.accounts || []
// Iterate over sources keys. Inject test libraries. Inject test library import statements.
@ -105,10 +105,11 @@ export function compileContractSources(sources: SrcIfc, importFileCb: any, opts:
async.waterfall([
function loadCompiler (next: Function) {
compiler = new RemixCompiler(importFileCb)
compiler.onInternalCompilerLoaded()
// compiler.event.register('compilerLoaded', this, function (version) {
next()
// });
compiler.loadVersion(usingWorker, versionUrl)
// @ts-ignore
compiler.event.register('compilerLoaded', this, (version) => {
next()
})
},
function doCompilation (next: Function) {
// @ts-ignore

@ -18,7 +18,7 @@ const createWeb3Provider = async function () {
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 || {}
let web3 = opts.web3 || await createWeb3Provider()
let accounts = opts.accounts || null
@ -31,7 +31,7 @@ export async function runTestSources(contractSources, testCallback, resultCallba
})
},
function compile (next) {
compileContractSources(contractSources, importFileCb, { accounts }, next)
compileContractSources(contractSources, versionUrl, usingWorker, importFileCb, { accounts }, next)
},
function deployAllContracts (compilationResult, next) {
deployAll(compilationResult, web3, (err, contracts) => {

Loading…
Cancel
Save