Merge pull request #47 from sc-forks/fix-options

Small exec.js cleanup, clarify port options settings in README
pull/48/head
c-g-e-w-e-k-e- 8 years ago committed by GitHub
commit 751a4e23a7
  1. 4
      README.md
  2. 19
      bin/exec.js

@ -64,8 +64,8 @@ some additional options:
+ **port**: *{ Number }* Port to run testrpc on / have truffle connect to. (Default: 8555) + **port**: *{ Number }* Port to run testrpc on / have truffle connect to. (Default: 8555)
+ **accounts**: *{ Number }* Number of accounts to launch testrpc with. (Default: 35) + **accounts**: *{ Number }* Number of accounts to launch testrpc with. (Default: 35)
+ **testrpcOptions**: *{ String }* options to append to a command line invocation of testrpc. + **testrpcOptions**: *{ String }* options to append to a command line invocation of testrpc.
+ ex: `--secure --unlock "0x1234..." --unlock "0xabcd..."`. + ex: `--secure --port 8555 --unlock "0x1234..." --unlock "0xabcd..."`.
+ NB: if you specify the port in your rpc options string, also declare it as a `port` option. + NB: you should specify a port in your rpc options string and also declare it in the config's `port` option.
+ **testCommand**: *{ String }* By default solidity-coverage runs `truffle test`. This option lets + **testCommand**: *{ String }* By default solidity-coverage runs `truffle test`. This option lets
you run an arbitrary test command instead, like: `mocha --timeout 5000`. you run an arbitrary test command instead, like: `mocha --timeout 5000`.
+ remember to set the config's port option to whatever port your tests use (probably 8545). + remember to set the config's port option to whatever port your tests use (probably 8545).

@ -73,13 +73,7 @@ if (config.silent) {
// environment folder. // environment folder.
log('Generating coverage environment'); log('Generating coverage environment');
try { try {
// Truffle environment: let files = shell.ls(workingDir);
// contracts/
// test/
// migrations/
// truffle.js
let files = shell.ls(`${workingDir}`);
const nmIndex = files.indexOf('node_modules'); const nmIndex = files.indexOf('node_modules');
if (!config.copyNodeModules && nmIndex > -1) { if (!config.copyNodeModules && nmIndex > -1) {
@ -87,15 +81,14 @@ try {
} }
files = files.map(file => `${workingDir}/` + file); files = files.map(file => `${workingDir}/` + file);
shell.mkdir(`${coverageDir}`); shell.mkdir(coverageDir);
shell.cp('-R', files, `${coverageDir}`); shell.cp('-R', files, coverageDir);
const truffleConfig = reqCwd.silent(`${workingDir}/truffle.js`); const truffleConfig = reqCwd.silent(`${workingDir}/truffle.js`);
// Coverage network opts specified: copy truffle.js whole to coverage environment // Coverage network opts specified: use port if declared
if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) { if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) {
port = truffleConfig.networks.coverage.port || port; port = truffleConfig.networks.coverage.port || port;
shell.cp(`${workingDir}/truffle.js`, `${coverageDir}/truffle.js`);
// Coverage network opts NOT specified: default to the development network w/ modified // Coverage network opts NOT specified: default to the development network w/ modified
// port, gasLimit, gasPrice. Export the config object only. // port, gasLimit, gasPrice. Export the config object only.
@ -203,9 +196,7 @@ try {
istanbulReporter.add('html'); istanbulReporter.add('html');
istanbulReporter.add('lcov'); istanbulReporter.add('lcov');
istanbulReporter.add('text'); istanbulReporter.add('text');
istanbulReporter.write(istanbulCollector, true, () => { istanbulReporter.write(istanbulCollector, true);
log('Istanbul coverage reports generated');
});
} catch (err) { } catch (err) {
if (config.testing) { if (config.testing) {
cleanUp(); cleanUp();

Loading…
Cancel
Save