diff --git a/remix-tests/src/compiler.ts b/remix-tests/src/compiler.ts index 6f0298fc11..34721198fa 100644 --- a/remix-tests/src/compiler.ts +++ b/remix-tests/src/compiler.ts @@ -172,6 +172,6 @@ export function compileContractSources(sources: SrcIfc, versionUrl: any, usingWo if (!isBrowser) require('signale').fatal(errors) return cb(errors) } - cb(err, result.contracts) + cb(err, result.contracts, result.sources) }) } diff --git a/remix-tests/src/runTestSources.ts b/remix-tests/src/runTestSources.ts index c6407b06e9..addd437dee 100644 --- a/remix-tests/src/runTestSources.ts +++ b/remix-tests/src/runTestSources.ts @@ -20,6 +20,7 @@ const createWeb3Provider = async function () { export async function runTestSources(contractSources, versionUrl, usingWorker, testCallback, resultCallback, finalCallback, importFileCb, opts) { opts = opts || {} + let sourceASTs: any = {} let web3 = opts.web3 || await createWeb3Provider() let accounts = opts.accounts || null async.waterfall([ @@ -33,7 +34,12 @@ export async function runTestSources(contractSources, versionUrl, usingWorker, t function compile (next) { compileContractSources(contractSources, versionUrl, usingWorker, importFileCb, { accounts }, next) }, - function deployAllContracts (compilationResult, next) { + function deployAllContracts (compilationResult, asts, next) { + for(const filename in asts) + { + if(filename.includes('_test.sol')) + sourceASTs[filename] = asts[filename].ast + } deployAll(compilationResult, web3, (err, contracts) => { if (err) { next(err) @@ -79,8 +85,7 @@ export async function runTestSources(contractSources, versionUrl, usingWorker, t } async.eachOfLimit(contractsToTest, 1, (contractName: string, index: string | number, cb: ErrorCallback) => { - // todo: pass AST - runTest(contractName, contracts[contractName], contractsToTestDetails[index], [], { accounts }, _testCallback, (err, result) => { + runTest(contractName, contracts[contractName], contractsToTestDetails[index], sourceASTs[contracts[contractName]['filename']], { accounts }, _testCallback, (err, result) => { if (err) { return cb(err) }