include filename in contract callback

pull/7/head
Iuri Matias 6 years ago
parent b95a20a98d
commit 6b098bfe6f
  1. 7
      src/deployer.js
  2. 2
      src/testRunner.js
  3. 4
      tests/testRunner.js

@ -53,7 +53,7 @@ function deployAll (compileResult, web3, callback) {
next(null, contractsToDeploy)
},
function deployContracts (contractsToDeploy, next) {
var deployRunner = (deployObject, contractObject, contractName, callback) => {
var deployRunner = (deployObject, contractObject, contractName, filename, callback) => {
deployObject.estimateGas().then((gasValue) => {
deployObject.send({
from: accounts[0],
@ -65,6 +65,7 @@ function deployAll (compileResult, web3, callback) {
compiledObject[contractName].deployedAddress = receipt.contractAddress
contracts[contractName] = contractObject
contracts[contractName].filename = filename
callback(null, { result: { createdAddress: receipt.contractAddress } }) // TODO this will only work with JavaScriptV VM
}).on('error', function (err) {
@ -80,7 +81,7 @@ function deployAll (compileResult, web3, callback) {
if (error) return nextEach(error)
let contractObject = new web3.eth.Contract(contract.abi)
let deployObject = contractObject.deploy({arguments: [], data: '0x' + contractDeployData.dataHex})
deployRunner(deployObject, contractObject, contractName, (error) => { nextEach(error) })
deployRunner(deployObject, contractObject, contractName, contract.filename, (error) => { nextEach(error) })
}
let encodeDataStepCallback = (msg) => { console.dir(msg) }
@ -90,7 +91,7 @@ function deployAll (compileResult, web3, callback) {
let code = compiledObject[libData.data.contractName].code
let libraryObject = new web3.eth.Contract(abi)
let deployObject = libraryObject.deploy({arguments: [], data: '0x' + code})
deployRunner(deployObject, libraryObject, libData.data.contractName, callback)
deployRunner(deployObject, libraryObject, libData.data.contractName, contract.filename, callback)
}
let funAbi = null // no need to set the abi for encoding the constructor

@ -38,7 +38,7 @@ function runTest (testName, testObject, testCallback, resultsCallback) {
let timePassed = 0
let web3 = new Web3()
testCallback({type: 'contract', value: testName})
testCallback({type: 'contract', value: testName, filename: testObject.filename})
async.eachOfLimit(runList, 1, function (func, index, next) {
let method = testObject.methods[func.name].apply(testObject.methods[func.name], [])
let startTime = Date.now()

@ -52,7 +52,7 @@ describe('testRunner', function () {
it('should returns 3 messages', function () {
assert.deepEqual(tests, [
{ type: 'contract', value: 'MyTest' },
{ type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' },
{ type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' },
{ type: 'testFailure', value: 'Initial value should be200', time: 1, context: 'MyTest', errMsg: 'function returned false' }
])
@ -86,7 +86,7 @@ describe('testRunner', function () {
it('should returns 3 messages', function () {
assert.deepEqual(tests, [
{ type: 'contract', value: 'MyTest' },
{ type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' },
{ type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' },
{ type: 'testPass', value: 'Initial value should be200', time: 1, context: 'MyTest' }
])

Loading…
Cancel
Save