sequence of tests from IDE

pull/7/head
aniket-engg 5 years ago
parent 0b77de3ca5
commit c84029a047
  1. 2
      remix-tests/src/compiler.ts
  2. 11
      remix-tests/src/runTestSources.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)
})
}

@ -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)
}

Loading…
Cancel
Save