Accomodate both locations NPM might install testrpc-sc

pull/1/head
cgewecke 8 years ago
parent c98d085718
commit a46f73355d
  1. 13
      exec.js

@ -67,10 +67,19 @@ if (config.silent) {
// (Changes here should be also be added to the before() block of test/run.js).
if (!config.norpc) {
try {
log(`Launching testrpc on port ${port}`);
const command = './node_modules/ethereumjs-testrpc-sc/bin/testrpc';
// NPM installs the testrpc-sc fork at different locations in node_modules based on
// whether testrpc is a pre-existing dependency of the project solcover is being added to
// using (--save-dev).
let command;
if (shell.test('-e', './node_modules/ethereumjs-testrpc-sc')) {
command = './node_modules/ethereumjs-testrpc-sc/bin/testrpc ';
} else {
command = './node_modules/solcover/node_modules/ethereumjs-testrpc-sc/bin/testrpc ';
}
const options = `--gasLimit ${gasLimitString} --port ${port}`;
testrpcProcess = childprocess.exec(command + options);
log(`Launching testrpc on port ${port}`);
} catch (err) {
const msg = `There was a problem launching testrpc: ${err}`;
cleanUp(msg);

Loading…
Cancel
Save