0

I am trying to build a DApp using Truffle. I have installed Testrpc and Truffle globally with NPM. I ran testrpc in a terminal window and ran truffle test. I get 2 passing and 3 failing tests. The three failing tests are:

TestMetacoin testInitialBalanceUsingDeployedContract:

TestMetacoin testInitialBalanceWithNewMetaCoin:

and

Contract: MetaCoin should send coin correctly:

each is failing with the same message:

Uncaught TypeError: Cannot read property '1' of undefined
  at /usr/local/lib/node_modules/truffle/node_modules/ethjs-abi/lib/index.js:139:34
  at Array.map (native)
  at Object.decodeEvent (/usr/local/lib/node_modules/truffle/node_modules/ethjs-abi/lib/index.js:138:6)
  at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:73:38
  at Array.map (native)
  at Object.decodeLogs (/usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:44:19)
  at Object.callback (/usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:172:35)
  at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/method.js:142:25
  at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/requestmanager.js:89:9
  at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:119:13)
  at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
  at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
  at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:509:12)
  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:469:24)

I am sure I am missing something simple, any help is appreciated.

Edit: So it looks like for some reason in the decodeEvent method is getting nil for topics in the failing tests. This is my first experience with truffle or daps so I am not really sure how to remedy this but I will keep digging.

  • 1
    Hi Ruby. I'm not sure this is on point, but suggest trying $ truffle migrate --reset, then test again. – Rob Hitchens - B9lab Mar 20 '17 at 0:32
  • Thank you for the reply. I did that with the same result. the tests are hitting the testrpc instance I am running as I can see transactions being created. – ruby_newbie Mar 20 '17 at 1:28
0

It turns out it was a bug in truffle. I had to uninstall and reinstall truffle and my tests are all green now. https://github.com/trufflesuite/truffle/issues/377

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.