Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erros in npm test on ethereum-testing-reference project #15

Open
gladsjr opened this issue Mar 17, 2017 · 1 comment
Open

Erros in npm test on ethereum-testing-reference project #15

gladsjr opened this issue Mar 17, 2017 · 1 comment

Comments

@gladsjr
Copy link

gladsjr commented Mar 17, 2017

I've cloned the project and run npm install. Trying npm test, I get what follows.
I've changed the solc version in package.json to 0.4.10. Nothing got different.

starter@ test /root/workspace/ethereum-testing-reference
mocha test/**/*-test.js --reporter mochawesome

Compiling files: ["ContractA.sol","ContractB.sol"]

/root/workspace/ethereum-testing-reference/node_modules/ethereum-sandbox/node_modules/solc/soljson.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"
std.sol:5:10: Error: Expected identifier, got 'Abstract'
contract abstract {}
^

npm ERR! Test failed. See above for more details.

@tomw1808
Copy link

There are several changes to be made to the code then it runs again (partly):

  1. replace all "abstract" by something like "abstractcontract"
  2. all modifiers (_) must end with a semicolon, e.g. if (msg.sender==owner) _;
  3. Nice to have: since solidity 0.4.0 its recommended to specify the version with a pragma line first in the solidity file: e.g. "pragma solidity ^0.4.10

But then still, there is another error when running it locally (haven't tested it in the ethereum studio):

 3) [Math.sol] Contracts Testing "before all" hook:
     Math.sol:Math.sol.js:566
    window.Math.sol:Math = Contract;
                   ^
SyntaxError: Unexpected token :
      at Object.exports.createScript (vm.js:47:10)
      at Object.requireFromSourceInject [as _requireFromSource] (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\ethereum-sandbox-workbench\workbench.js:87:19)
      at Object.whisk (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\ether-pudding\index.js:148:17)
      at Object.keys.forEach.contractName (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\ethereum-sandbox-workbench\workbench.js:277:35)
      at Array.forEach (native)
      at Workbench.compile (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\ethereum-sandbox-workbench\workbench.js:271:33)
      at Workbench.<anonymous> (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\ethereum-sandbox-workbench\workbench.js:427:45)
      at Context.<anonymous> (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\ethereum-sandbox-workbench\workbench.js:441:9)
      at callFnAsync (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\mocha\lib\runnable.js:349:8)
      at Hook.Runnable.run (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\mocha\lib\runnable.js:301:7)
      at next (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\mocha\lib\runner.js:298:10)
      at Immediate.<anonymous> (D:\Courses\ethereum1\codesamples\ethereum-testing-reference\node_modules\mocha\lib\runner.js:320:5)

  4) [Math.sol] Contracts Testing "after all" hook:
     Error: connect ECONNREFUSED 127.0.0.1:8554
      at Object.exports._errnoException (util.js:1026:11)
      at exports._exceptionWithHostPort (util.js:1049:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)

  5) [GoldPrice.sol, GoldPriceChecker.sol] Contracts Testing "before all" hook:
     GoldPrice.sol:GoldPrice.sol.js:522
    window.GoldPrice.sol:GoldPrice = Contract;

I'm not exactly sure where that comes from...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants