Commit c84029a0 authored by aniket-engg's avatar aniket-engg

sequence of tests from IDE

parent 0b77de3c
...@@ -172,6 +172,6 @@ export function compileContractSources(sources: SrcIfc, versionUrl: any, usingWo ...@@ -172,6 +172,6 @@ export function compileContractSources(sources: SrcIfc, versionUrl: any, usingWo
if (!isBrowser) require('signale').fatal(errors) if (!isBrowser) require('signale').fatal(errors)
return cb(errors) return cb(errors)
} }
cb(err, result.contracts) cb(err, result.contracts, result.sources)
}) })
} }
...@@ -20,6 +20,7 @@ const createWeb3Provider = async function () { ...@@ -20,6 +20,7 @@ const createWeb3Provider = async function () {
export async function runTestSources(contractSources, versionUrl, usingWorker, testCallback, resultCallback, finalCallback, importFileCb, opts) { export async function runTestSources(contractSources, versionUrl, usingWorker, testCallback, resultCallback, finalCallback, importFileCb, opts) {
opts = opts || {} opts = opts || {}
let sourceASTs: any = {}
let web3 = opts.web3 || await createWeb3Provider() let web3 = opts.web3 || await createWeb3Provider()
let accounts = opts.accounts || null let accounts = opts.accounts || null
async.waterfall([ async.waterfall([
...@@ -33,7 +34,12 @@ export async function runTestSources(contractSources, versionUrl, usingWorker, t ...@@ -33,7 +34,12 @@ export async function runTestSources(contractSources, versionUrl, usingWorker, t
function compile (next) { function compile (next) {
compileContractSources(contractSources, versionUrl, usingWorker, importFileCb, { accounts }, 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) => { deployAll(compilationResult, web3, (err, contracts) => {
if (err) { if (err) {
next(err) next(err)
...@@ -79,8 +85,7 @@ export async function runTestSources(contractSources, versionUrl, usingWorker, t ...@@ -79,8 +85,7 @@ export async function runTestSources(contractSources, versionUrl, usingWorker, t
} }
async.eachOfLimit(contractsToTest, 1, (contractName: string, index: string | number, cb: ErrorCallback) => { async.eachOfLimit(contractsToTest, 1, (contractName: string, index: string | number, cb: ErrorCallback) => {
// todo: pass AST runTest(contractName, contracts[contractName], contractsToTestDetails[index], sourceASTs[contracts[contractName]['filename']], { accounts }, _testCallback, (err, result) => {
runTest(contractName, contracts[contractName], contractsToTestDetails[index], [], { accounts }, _testCallback, (err, result) => {
if (err) { if (err) {
return cb(err) return cb(err)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment