|
1 | 1 | import async, { ErrorCallback } from 'async' |
2 | | -import deepequal from 'deep-equal' |
3 | | -import { Compiler as RemixCompiler } from '@remix-project/remix-solidity' |
4 | 2 | import { compileContractSources, writeTestAccountsContract } from './compiler' |
5 | 3 | import { deployAll } from './deployer' |
6 | 4 | import { runTest } from './testRunner' |
@@ -50,29 +48,13 @@ export class UnitTestRunner { |
50 | 48 | * @param importFileCb Import file callback |
51 | 49 | * @param opts Options |
52 | 50 | */ |
53 | | - async runTestSources (contractSources: SrcIfc, compilerConfig: CompilerConfiguration, testCallback, resultCallback, deployCb:any, finalCallback: any, importFileCb, opts: Options) { |
| 51 | + async runTestSources (contractSources: SrcIfc, newCompilerConfig: CompilerConfiguration, testCallback, resultCallback, deployCb:any, finalCallback: any, importFileCb, opts: Options) { |
54 | 52 | opts = opts || {} |
55 | 53 | const sourceASTs: any = {} |
56 | 54 | if (opts.web3 || opts.accounts) this.init(opts.web3, opts.accounts) |
57 | | - |
58 | 55 | async.waterfall([ |
59 | 56 | (next) => { |
60 | | - if (!deepequal(this.compilerConfig, compilerConfig)) { |
61 | | - this.compilerConfig = compilerConfig |
62 | | - const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = compilerConfig |
63 | | - this.compiler = new RemixCompiler(importFileCb) |
64 | | - this.compiler.set('evmVersion', evmVersion) |
65 | | - this.compiler.set('optimize', optimize) |
66 | | - this.compiler.set('runs', runs) |
67 | | - this.compiler.loadVersion(usingWorker, currentCompilerUrl) |
68 | | - // @ts-ignore |
69 | | - this.compiler.event.register('compilerLoaded', this, (version) => { |
70 | | - next() |
71 | | - }) |
72 | | - } else next() |
73 | | - }, |
74 | | - (next) => { |
75 | | - compileContractSources(contractSources, this.compiler, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next) |
| 57 | + compileContractSources(contractSources, newCompilerConfig, importFileCb, this, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next) |
76 | 58 | }, |
77 | 59 | (compilationResult: compilationInterface, asts: ASTInterface, next) => { |
78 | 60 | for (const filename in asts) { |
|
0 commit comments