Aftter truffle init, tests don't work
See original GitHub issueWe created a brand new project via truffle init
. Then, after starting a private testnet, unlocking the primary address, starting the miner and running the tests, I get the following error.
Contract: MetaCoin
✓ should put 10000 MetaCoin in the first account
1) should call a function that depends on a linked library
> No events were emitted
2) should send coin correctly
> No events were emitted
1) Contract: MetaCoin should call a function that depends on a linked library :
AssertionError: Library function returned unexpeced function, linkage may be broken: expected 0 to equal 20000
2) Contract: MetaCoin should send coin correctly:
BigNumber Error: new BigNumber() not a number: [object Object]
We didn’t get to looking at the second error, but for the first one, we got the following info:
outCoinBalance: { [String: '10000'] s: 1, e: 4, c: [ 10000 ] }
outCoinBalance.toNumber(): 10000
outCoinBalanceEth: { [String: '0'] s: 1, e: 0, c: [ 0 ] }
metaCoinEthBalance: 0
2 * metaCoinBalance: 20000
It looks like meta.getBalanceInEth.call(accounts[0])
, which is setting outCoinBalanceEth
is not returning the correct value.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Truffle Init - No Tests? · Issue #4041 · trufflesuite/truffle - GitHub
Yes but after truffle init there are really no contracts to test yet. All reactions.
Read more >Truffle tests not running after truffle init | Edureka Community
I have installed Testrpc and Truffle globally with NPM. I ran testrpc in a terminal window and ran truffle test.
Read more >Truffle does nothing and shows no output when running tests
I would run the command truffle init and that would run fine. When I tried to run truffle test nothing would happen. No...
Read more >Can't test simple Truffle project - solidity - Stack Overflow
truffle create test TestSimpleProject command creates a file test/test_simple_project.js with the following contents:
Read more >Test your contracts - Truffle Suite
Note: When the truffle test process exits, its exit code is equal to the number of failing tests. If there are more than...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same thing still with Truffle 2.1.1. This issue should really be reopened.
For those of you that uses a private net geth for development, configure your genesis block as follows:
The key point here is the
homesteadBlock
, which enables certain features includingDELEGATECALL
, which is what libraries are dependent on.Homestead block is by default set to 1.150.000. This would explain why truffle works with testrpc but not with a private chain.
Source: https://blog.ethereum.org/2016/02/29/homestead-release/