From 7186584f14ad705e3e46123c4f1c263f6be9417d Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 2 Apr 2019 21:26:44 +0200 Subject: [PATCH 1/3] fix runTestSources --- remix-tests/src/runTestSources.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/remix-tests/src/runTestSources.ts b/remix-tests/src/runTestSources.ts index c9e18fbff3..b8490befd8 100644 --- a/remix-tests/src/runTestSources.ts +++ b/remix-tests/src/runTestSources.ts @@ -4,9 +4,10 @@ require('colors') import { compileContractSources } from './compiler' import { deployAll } from './deployer' import { runTest } from './testRunner' +import { TestResultInterface, ResultsInterface } from './types' import Web3 = require('web3') -import Provider from 'remix-simulator' +import { Provider } from 'remix-simulator' import { FinalResult } from './types' const createWeb3Provider = function () { @@ -28,7 +29,7 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi }) }, function compile (next) { - compileContractSources(contractSources, importFileCb, opts, next) + compileContractSources(contractSources, importFileCb, { accounts }, next) }, function deployAllContracts (compilationResult, next) { deployAll(compilationResult, web3, (err, contracts) => { @@ -60,7 +61,7 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi let totalTime = 0 let errors: any[] = [] - const _testCallback = function (result) { + const _testCallback = function (err: Error | null | undefined, result: TestResultInterface) { if (result.type === 'testFailure') { errors.push(result) } @@ -75,8 +76,8 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi cb() } - async.eachOfLimit(contractsToTest, 1, (contractName, index, cb) => { - runTest(contractName, contracts(contractName), contractsToTestDetails[index], { accounts }, _testCallback, (err, result) => { + async.eachOfLimit(contractsToTest, 1, (contractName: string, index, cb) => { + runTest(contractName, contracts[contractName], contractsToTestDetails[index], { accounts }, _testCallback, (err, result) => { if (err) { return cb(err) } From 74d9df1d2f04cee420f237a3dfb048886b0472e3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 2 Apr 2019 21:26:55 +0200 Subject: [PATCH 2/3] fix require --- remix-tests/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remix-tests/src/index.ts b/remix-tests/src/index.ts index aad3269514..b786ceda08 100644 --- a/remix-tests/src/index.ts +++ b/remix-tests/src/index.ts @@ -2,4 +2,4 @@ export { runTestFiles } from './runTestFiles' export { runTestSources } from './runTestSources' export { runTest } from './testRunner' export * from './types' -export { assertLibCode } from '../sol/tests.sol.js' +export const assertLibCode = require('../sol/tests.sol.js') From a05e65bed6353750752409cb3dcf2e9f0223ead4 Mon Sep 17 00:00:00 2001 From: 0mkar <0mkar@protonmail.com> Date: Wed, 3 Apr 2019 06:17:16 +0530 Subject: [PATCH 3/3] Add types to eachOfLimit callback --- remix-tests/src/runTestSources.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remix-tests/src/runTestSources.ts b/remix-tests/src/runTestSources.ts index b8490befd8..4e765434fd 100644 --- a/remix-tests/src/runTestSources.ts +++ b/remix-tests/src/runTestSources.ts @@ -1,4 +1,4 @@ -import async from 'async' +import async, { ErrorCallback } from 'async' require('colors') import { compileContractSources } from './compiler' @@ -76,7 +76,7 @@ export function runTestSources(contractSources, testCallback, resultCallback, fi cb() } - async.eachOfLimit(contractsToTest, 1, (contractName: string, index, cb) => { + async.eachOfLimit(contractsToTest, 1, (contractName: string, index: string | number, cb: ErrorCallback) => { runTest(contractName, contracts[contractName], contractsToTestDetails[index], { accounts }, _testCallback, (err, result) => { if (err) { return cb(err)