Skip to content

Commit 751a4e2

Browse files
authored
Merge pull request #47 from sc-forks/fix-options
Small exec.js cleanup, clarify port options settings in README
2 parents 8272ccc + f2d4e71 commit 751a4e2

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

README.md

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

bin/exec.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,23 @@ if (config.silent) {
7373
// environment folder.
7474
log('Generating coverage environment');
7575
try {
76-
// Truffle environment:
77-
// contracts/
78-
// test/
79-
// migrations/
80-
// truffle.js
81-
82-
let files = shell.ls(`${workingDir}`);
76+
let files = shell.ls(workingDir);
8377
const nmIndex = files.indexOf('node_modules');
8478

8579
if (!config.copyNodeModules && nmIndex > -1) {
8680
files.splice(nmIndex, 1); // Removes node_modules from array.
8781
}
8882

8983
files = files.map(file => `${workingDir}/` + file);
90-
shell.mkdir(`${coverageDir}`);
91-
shell.cp('-R', files, `${coverageDir}`);
84+
shell.mkdir(coverageDir);
85+
shell.cp('-R', files, coverageDir);
9286

9387
const truffleConfig = reqCwd.silent(`${workingDir}/truffle.js`);
9488

95-
// Coverage network opts specified: copy truffle.js whole to coverage environment
89+
// Coverage network opts specified: use port if declared
9690
if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) {
9791
port = truffleConfig.networks.coverage.port || port;
98-
shell.cp(`${workingDir}/truffle.js`, `${coverageDir}/truffle.js`);
99-
92+
10093
// Coverage network opts NOT specified: default to the development network w/ modified
10194
// port, gasLimit, gasPrice. Export the config object only.
10295
} else {
@@ -203,9 +196,7 @@ try {
203196
istanbulReporter.add('html');
204197
istanbulReporter.add('lcov');
205198
istanbulReporter.add('text');
206-
istanbulReporter.write(istanbulCollector, true, () => {
207-
log('Istanbul coverage reports generated');
208-
});
199+
istanbulReporter.write(istanbulCollector, true);
209200
} catch (err) {
210201
if (config.testing) {
211202
cleanUp();

0 commit comments

Comments
 (0)