fix linting

pull/7/head
yann300 6 years ago
parent 44bb8ccc27
commit 967b26f3f0
  1. 2
      sol/tests.sol.js
  2. 4
      src/deployer.js
  3. 23
      src/index.js
  4. 6
      src/testRunner.js

@ -100,4 +100,4 @@ library Assert {
//} //}
} }
`; `

@ -56,8 +56,8 @@ function deployAll (compileResult, web3, callback) {
async.eachOfLimit(contractsToDeploy, 1, function (contractName, index, nextEach) { async.eachOfLimit(contractsToDeploy, 1, function (contractName, index, nextEach) {
let contract = compiledObject[contractName] let contract = compiledObject[contractName]
if (!contract) { if (!contract) {
console.error("Contract not found: " + contractName); console.error('Contract not found: ' + contractName)
return nextEach(new Error("Contract not found: " + contractName)); return nextEach(new Error('Contract not found: ' + contractName))
} }
let contractObject = new web3.eth.Contract(contract.abi) let contractObject = new web3.eth.Contract(contract.abi)

@ -22,7 +22,7 @@ var runTestSources = function (contractSources, testCallback, resultCallback, fi
Compiler.compileContractSources(contractSources, importFileCb, next) Compiler.compileContractSources(contractSources, importFileCb, next)
}, },
function deployAllContracts (compilationResult, next) { function deployAllContracts (compilationResult, next) {
let web3 = createWeb3Provider(); let web3 = createWeb3Provider()
Deployer.deployAll(compilationResult, web3, function (err, contracts) { Deployer.deployAll(compilationResult, web3, function (err, contracts) {
if (err) { if (err) {
next(err) next(err)
@ -35,7 +35,6 @@ var runTestSources = function (contractSources, testCallback, resultCallback, fi
let contractsToTest = [] let contractsToTest = []
for (let filename in compilationResult) { for (let filename in compilationResult) {
let contract = compilationResult[filename];
if (filename.indexOf('_test.sol') < 0) { if (filename.indexOf('_test.sol') < 0) {
continue continue
} }
@ -56,11 +55,11 @@ var runTestSources = function (contractSources, testCallback, resultCallback, fi
if (result.type === 'testFailure') { if (result.type === 'testFailure') {
errors.push(result) errors.push(result)
} }
testCallback(result); testCallback(result)
} }
var _resultsCallback = function (_err, result, cb) { var _resultsCallback = function (_err, result, cb) {
resultCallback(_err, result, () => {}); resultCallback(_err, result, () => {})
totalPassing += result.passingNum totalPassing += result.passingNum
totalFailing += result.failureNum totalFailing += result.failureNum
totalTime += result.timePassed totalTime += result.timePassed
@ -79,21 +78,21 @@ var runTestSources = function (contractSources, testCallback, resultCallback, fi
return next(err) return next(err)
} }
let finalResults = {}; let finalResults = {}
finalResults.totalPassing = totalPassing || 0; finalResults.totalPassing = totalPassing || 0
finalResults.totalFailing = totalFailing || 0; finalResults.totalFailing = totalFailing || 0
finalResults.totalTime = totalTime || 0; finalResults.totalTime = totalTime || 0
finalResults.errors = []; finalResults.errors = []
errors.forEach((error, _index) => { errors.forEach((error, _index) => {
finalResults.errors.push({context: error.context, value: error.value, message: error.errMsg}); finalResults.errors.push({context: error.context, value: error.value, message: error.errMsg})
}) })
next(null, finalResults); next(null, finalResults)
}) })
} }
], finalCallback); ], finalCallback)
} }
var runTestFiles = function (filepath, isDirectory, web3) { var runTestFiles = function (filepath, isDirectory, web3) {

@ -36,7 +36,7 @@ function runTest (testName, testObject, testCallback, resultsCallback) {
let passingNum = 0 let passingNum = 0
let failureNum = 0 let failureNum = 0
let timePassed = 0 let timePassed = 0
let web3 = new Web3(); let web3 = new Web3()
testCallback({type: 'contract', value: testName}) testCallback({type: 'contract', value: testName})
async.eachOfLimit(runList, 1, function (func, index, next) { async.eachOfLimit(runList, 1, function (func, index, next) {
@ -85,8 +85,8 @@ function runTest (testName, testObject, testCallback, resultsCallback) {
} }
// } // }
} catch (err) { } catch (err) {
console.log("error!"); console.log('error!')
console.dir(err); console.dir(err)
return next(err) return next(err)
} }
next() next()

Loading…
Cancel
Save