ConsenSysMesh / dao-wars

MIT License
50 stars 7 forks source link

Tests don't work? #1

Open taoeffect opened 8 years ago

taoeffect commented 8 years ago

Using Truffle v0.2.7, node 4.2.1, I run truffle test in the directory and get:

-> % truffle test
Using environment test.
/usr/local/lib/node_modules/truffle/node_modules/solc/bin/soljson-latest.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileS

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
  at /usr/local/lib/node_modules/truffle/lib/test.es6:73:34
  at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/property.js:118:13
  at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:82:20
  at [object Object].request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
  at [object Object].dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
  at setState (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
  at [object Object].handleError (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5)
  at ClientRequest.errorHandler (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14)
  at emitOne (events.js:77:13)
  at ClientRequest.emit (events.js:169:7)
  at Socket.socketErrorListener (_http_client.js:259:9)
  at emitOne (events.js:77:13)
  at Socket.emit (events.js:169:7)
  at emitErrorNT (net.js:1253:8)
  at doNTCallback2 (node.js:439:9)
  at process._tickDomainCallback (node.js:394:17)
  at Function.module.exports.loopWhile (/usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:64:21)
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:36:18
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:347:14)
  at Module._compile (module.js:435:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:435:26)
  at Object.Module._extensions..js (module.js:442:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at startup (node.js:134:18)
  at node.js:961:3

So I tried installing latest version of node (5.0.0), and after fighting to get truffle installed (https://github.com/ConsenSys/truffle/issues/53) I get a slightly different error, but virtually the same:

Using environment test.
/usr/local/lib/node_modules/truffle/node_modules/solc/bin/soljson-latest.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileS

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
  at /usr/local/lib/node_modules/truffle/lib/test.es6:73:34
  at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/property.js:118:13
  at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:82:20
  at [object Object].request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
  at [object Object].dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
  at setState (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
  at [object Object].handleError (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5)
  at ClientRequest.errorHandler (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14)
  at emitOne (events.js:77:13)
  at ClientRequest.emit (events.js:169:7)
  at Socket.socketErrorListener (_http_client.js:265:9)
  at emitOne (events.js:77:13)
  at Socket.emit (events.js:169:7)
  at emitErrorNT (net.js:1253:8)
  at doNTCallback2 (node.js:450:9)
  at process._tickDomainCallback (node.js:405:17)
  at Function.module.exports.loopWhile (/usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:64:21)
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:36:18
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:347:14)
  at Module._compile (module.js:425:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:457:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:425:26)
  at Object.Module._extensions..js (module.js:432:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:457:10)
  at startup (node.js:136:18)
  at node.js:972:3

This is on OS X with latest cpp-ethereum (though I doubt that matters in this case).

tcoulter commented 8 years ago

@taoeffect Are you running an RPC client? I think some of the latest changes to truffle have squelched an error stating your ethereum client of choice (eth, geth, pyethereum, testrpc, ethersim) must be running.

taoeffect commented 8 years ago

Just for other readers, this thread continues here: https://github.com/ConsenSys/truffle/issues/54#issuecomment-156580305

taoeffect commented 8 years ago

OK, now using @tcoulter's build of EtherSim the tests run, but break:

-> % truffle test
Using environment test.
Compiling contracts...

  Contract: Board
    - can randomly add eth
    1) returns eth in bulk

  Contract: Creature
    2) should let the brain move it
    3) should let the brain harvest eth
    4) should let the brain attack neighbors
    5) should die if brought to 0 hp
    6) should allow the brain to reproduce
    7) should only allow actions on its turn

  Contract: Game
    ✓ generates a board (310ms)
    8) allows creatures to be added

  1 passing (3s)
  1 pending
  8 failing

  1) Contract: Board returns eth in bulk:
     AssertionError: expected 0 to equal 9
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/board.js:30:14
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  2) Contract: Creature should let the brain move it:
     TypeError: creature.notify_of_turn is not a function
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/creature.js:21:23
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  3) Contract: Creature should let the brain harvest eth:
     TypeError: creature.notify_of_turn is not a function
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/creature.js:60:23
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  4) Contract: Creature should let the brain attack neighbors:
     TypeError: creature_1.notify_of_turn is not a function
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/creature.js:107:27
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  5) Contract: Creature should die if brought to 0 hp:
     TypeError: creature_1.notify_of_turn is not a function
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/creature.js:139:27
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  6) Contract: Creature should allow the brain to reproduce:
     TypeError: creature_1.notify_of_turn is not a function
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/creature.js:199:25
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  7) Contract: Creature should only allow actions on its turn:
     TypeError: creature.notify_of_turn is not a function
    at /Users/greg/dapps/mine/truffle_demo-dao-wars/test/creature.js:243:23
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

  8) Contract: Game allows creatures to be added:
     Error: done() invoked with non-Error: invalid address
    at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
    at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
    at Promise._settlePromises (node_modules/bluebird/js/main/promise.js:697:14)
    at Async._drainQueue (node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
    at Function.module.exports.loopWhile (node_modules/deasync/index.js:64:21)
    at node_modules/deasync/index.js:36:18
    at runTask (truffle.es6:55:5)
    at Object.<anonymous> (truffle.es6:347:14)
    at normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .es6] (node_modules/babel-core/lib/api/register/node.js:216:7)
    at Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)
    at node.js:972:3

EtherSim, meanwhile, returned: http://pastebin.com/Z9GZud53