Closed k06a closed 6 years ago
Hi @k06a. If you're doing this in your solidity files:
import "zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
Do this in your .solcover.js
config file
module.exports = {
copyNodeModules: true
}
At the moment we don't automatically copy the modules because it can take a long time and this is only a problem when importing solidity into solidity from npm installed packages. Solidity's import directive doesn't recursively search outside the parent directory the way JS import or require does.
@cgewecke thanks for instant reply! I'll try in a few minutes.
@cgewecke having a new issue: https://travis-ci.org/bitclave/crowdsale/builds/289719158
/home/travis/build/bitclave/crowdsale/coverageEnv/test/BaseCrowdsaleTest.js:3
import {duration, increaseTimeTo} from "./helpers/increaseTime";
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at /home/travis/build/bitclave/crowdsale/node_modules/truffle/node_modules/mocha/lib/mocha.js:231:27
Content of .solcover.js
:
require('babel-register');
require('babel-polyfill');
module.exports = {
copyNodeModules: true
}
I was partially copied from truffle.js
config:
require('babel-register');
require('babel-polyfill');
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*",
gas: 6000000
}
}
};
See #136.
@cgewecke what is coverage network
? Sorry, I'm really new to JS/Solidity.
@cgewecke does it mean to add this to truffle.js
?
require('babel-register');
require('babel-polyfill');
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*",
gas: 6000000
},
coverage: {
host: "localhost",
port: 8545,
network_id: "*",
gas: 6000000
}
}
};
My next problem https://travis-ci.org/bitclave/crowdsale/builds/289838038:
testRpc stdout:
EthereumJS TestRPC v4.0.2 (ganache-core: 1.0.1)
testRpc stderr:
events.js:163
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::8545
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at Server.setupListenHandle [as _listen2] (net.js:1259:14)
at listenInCluster (net.js:1307:12)
at Server.listen (net.js:1406:7)
at Server.server.listen (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:119382:17)
at Object.<anonymous> (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:41896:8)
at __webpack_require__ (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:21:30)
at /home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:64:18
at Object.<anonymous> (/home/travis/build/bitclave/crowdsale/node_modules/ethereumjs-testrpc-sc/build/cli.node.js:67:10)
Added pkill -9 testrpc
step before coverage step in .travis.yml
Added testrpcOptions
to increase gas limit to .solcover.js
:
require('babel-register');
require('babel-polyfill');
module.exports = {
copyNodeModules: true,
testrpcOptions: '-l 6000000'
}
Right now using following configuration of truffle.js
:
require('babel-register');
require('babel-polyfill');
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*",
gas: 10000000
},
coverage: {
host: "localhost",
port: 8545,
network_id: "*",
gas: 10000000
}
}
};
Content of .solcover.js
:
require('babel-register');
require('babel-polyfill');
module.exports = {
copyNodeModules: true,
norpc: true
}
Content of .travis.yml
:
sudo: required
dist: trusty
language: node_js
node_js:
- '7'
install:
- npm install -g truffle
- npm install -g ethereumjs-testrpc
- npm install
script:
- npm test
before_script:
- scripts/rpc.sh > /dev/null &
- sleep 5
after_script:
- npm run coverage && cat coverage/lcov.info | coveralls
Content of rpc.sh
:
#!/usr/bin/env bash
testrpc -l 10000000
I am having problems with gas:
1) Contract: Crowdsale: "before all" hook:
Error: VM Exception while processing transaction: out of gas
https://travis-ci.org/bitclave/crowdsale/builds/289971276
10M of gas should be enough!
Hi. Please look at the link to the zeppelin truffle config in #136 and copy the values in their coverage network. They are the same values recommended in the README doc as well. I think your babel imports should be made there too. The solcover config is only for coverage options.
On Oct 19, 2017 6:20 AM, "Anton Bukov" notifications@github.com wrote:
Right now using following configuration of truffle.js:
require('babel-register'); require('babel-polyfill');
module.exports = { networks: { development: { host: "localhost", port: 8545, network_id: "", gas: 10000000 }, coverage: { host: "localhost", port: 8545, network_id: "", gas: 10000000 } } };
Content of .solcover.js:
require('babel-register'); require('babel-polyfill');
module.exports = { copyNodeModules: true, norpc: true }
Content of .travis.yml:
sudo: required dist: trusty language: node_js node_js:
- '7' install:
- npm install -g truffle
- npm install -g ethereumjs-testrpc
- npm install script:
- npm test before_script:
- scripts/rpc.sh > /dev/null &
- sleep 5 after_script:
- npm run coverage && cat coverage/lcov.info | coveralls
Content of rpc.sh:
!/usr/bin/env bash
testrpc -l 10000000
I am having problems with gas:
1) Contract: Crowdsale: "before all" hook: Error: VM Exception while processing transaction: out of gas
https://travis-ci.org/bitclave/crowdsale/builds/289971276
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sc-forks/solidity-coverage/issues/137#issuecomment-337905542, or mute the thread https://github.com/notifications/unsubscribe-auth/AG_gumgHmPPnIRx1ZB7rRZbmsFzRDgwoks5st0yigaJpZM4P-Zq4 .
Also just try letting solidity-coverage launch its own testrpc in travis. Don't run one yourself unless you have to, and follow the recommendations in the FAQ if you do.
On Oct 19, 2017 6:38 AM, "chris gewecke" christophergewecke@gmail.com wrote:
Hi. Please look at the link to the zeppelin truffle config in #136 and copy the values in their coverage network. They are the same values recommended in the README doc as well. I think your babel imports should be made there too. The solcover config is only for coverage options.
On Oct 19, 2017 6:20 AM, "Anton Bukov" notifications@github.com wrote:
Right now using following configuration of truffle.js:
require('babel-register'); require('babel-polyfill');
module.exports = { networks: { development: { host: "localhost", port: 8545, network_id: "", gas: 10000000 }, coverage: { host: "localhost", port: 8545, network_id: "", gas: 10000000 } } };
Content of .solcover.js:
require('babel-register'); require('babel-polyfill');
module.exports = { copyNodeModules: true, norpc: true }
Content of .travis.yml:
sudo: required dist: trusty language: node_js node_js:
- '7' install:
- npm install -g truffle
- npm install -g ethereumjs-testrpc
- npm install script:
- npm test before_script:
- scripts/rpc.sh > /dev/null &
- sleep 5 after_script:
- npm run coverage && cat coverage/lcov.info | coveralls
Content of rpc.sh:
!/usr/bin/env bash
testrpc -l 10000000
I am having problems with gas:
1) Contract: Crowdsale: "before all" hook: Error: VM Exception while processing transaction: out of gas
https://travis-ci.org/bitclave/crowdsale/builds/289971276
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sc-forks/solidity-coverage/issues/137#issuecomment-337905542, or mute the thread https://github.com/notifications/unsubscribe-auth/AG_gumgHmPPnIRx1ZB7rRZbmsFzRDgwoks5st0yigaJpZM4P-Zq4 .
Finally fixed my issues. Do not know how exactly: https://github.com/bitclave/crowdsale @cgewecke thanks for help!
We are using
zeppelin-solidity
package.https://travis-ci.org/bitclave/crowdsale/builds/289704002