From 7599a74b898bce2f809a88b0cc1790f0b8a313cf Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 27 Sep 2019 15:20:43 +0530 Subject: [PATCH 1/3] tests with worker --- remix-tests/src/compiler.ts | 4 ++-- remix-tests/src/runTestSources.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/remix-tests/src/compiler.ts b/remix-tests/src/compiler.ts index e84f1780b2..18cb19156a 100644 --- a/remix-tests/src/compiler.ts +++ b/remix-tests/src/compiler.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,7 +105,7 @@ export function compileContractSources(sources: SrcIfc, importFileCb: any, opts: async.waterfall([ function loadCompiler (next: Function) { compiler = new RemixCompiler(importFileCb) - compiler.onInternalCompilerLoaded() + compiler.loadVersion(usingWorker, versionUrl) // compiler.event.register('compilerLoaded', this, function (version) { next() // }); diff --git a/remix-tests/src/runTestSources.ts b/remix-tests/src/runTestSources.ts index eefa1be9ba..adb89529ce 100644 --- a/remix-tests/src/runTestSources.ts +++ b/remix-tests/src/runTestSources.ts @@ -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) => { From 3f037c33188d7bfb93a6d88848ef7734c39537b5 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 27 Sep 2019 20:05:04 +0530 Subject: [PATCH 2/3] wait for compiler to load --- remix-tests/src/compiler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remix-tests/src/compiler.ts b/remix-tests/src/compiler.ts index 18cb19156a..9d580df4a2 100644 --- a/remix-tests/src/compiler.ts +++ b/remix-tests/src/compiler.ts @@ -106,9 +106,9 @@ export function compileContractSources(sources: SrcIfc, versionUrl: any, usingWo function loadCompiler (next: Function) { compiler = new RemixCompiler(importFileCb) compiler.loadVersion(usingWorker, versionUrl) - // compiler.event.register('compilerLoaded', this, function (version) { - next() - // }); + compiler.event.register('compilerLoaded', this, function (version) { + next() + }); }, function doCompilation (next: Function) { // @ts-ignore From a69f11bef0b7198798674d41ebc37b09ee91cc79 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 27 Sep 2019 20:13:25 +0530 Subject: [PATCH 3/3] linting fix --- remix-tests/src/compiler.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/remix-tests/src/compiler.ts b/remix-tests/src/compiler.ts index 9d580df4a2..ae48a8c097 100644 --- a/remix-tests/src/compiler.ts +++ b/remix-tests/src/compiler.ts @@ -106,9 +106,10 @@ export function compileContractSources(sources: SrcIfc, versionUrl: any, usingWo function loadCompiler (next: Function) { compiler = new RemixCompiler(importFileCb) compiler.loadVersion(usingWorker, versionUrl) - compiler.event.register('compilerLoaded', this, function (version) { + // @ts-ignore + compiler.event.register('compilerLoaded', this, (version) => { next() - }); + }) }, function doCompilation (next: Function) { // @ts-ignore