JoinColony / solcover

Code coverage for solidity
MIT License
64 stars 8 forks source link

Solidity test fail on default template #63

Closed h3ph4est7s closed 7 years ago

h3ph4est7s commented 7 years ago

Execution failed on default template with the following error. I suspect that the problem lies when truffle try to run solidity unit tests like TestMetacoin.sol

test@codevm:~/solcover$ node runCoveredTests.js 
instrumenting  originalContracts/ConvertLib.sol
instrumenting  originalContracts/MetaCoin.sol
instrumenting  originalContracts/Migrations.sol
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./test/TestMetacoin.sol...
Compiling truffle/Assert.sol...
Compiling truffle/DeployedAddresses.sol...

  TestMetacoin
    ✓ testInitialBalanceUsingDeployedContract (107ms)
    1) testInitialBalanceWithNewMetaCoin
    > No events were emitted

  Contract: MetaCoin
    ✓ should put 10000 MetaCoin in the first account (97ms)
    ✓ should call a function that depends on a linked library (216ms)
    ✓ should send coin correctly (414ms)

  4 passing (2s)
  1 failing

  1) TestMetacoin testInitialBalanceWithNewMetaCoin:
     Error: VM Exception while processing transaction: invalid opcode
      at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
      at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:86:36
      at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:118: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)
      at endReadableNT (_stream_readable.js:974:12)
lewisbarber commented 7 years ago

+1 I'm seeing the same problem with my unit tests... Running truffle test and everything works, running via this plugin I get invalid opcode.

area commented 7 years ago

Closing this now that we're over at solidity-coverage. If you still encounter this problem with the version installed from npm, via npm install solidity-coverage, please let us know over there.