Merge pull request #41 from sc-forks/permit-non-truffle

Stop crashing on encounters with non-truffle projects
copy-all-folders
c-g-e-w-e-k-e- 8 years ago committed by GitHub
commit 4beb02eb8c
  1. 13
      bin/exec.js

@ -83,10 +83,10 @@ try {
shell.cp('-R', `${workingDir}/test`, `${coverageDir}`); shell.cp('-R', `${workingDir}/test`, `${coverageDir}`);
shell.cp('-R', `${workingDir}/migrations`, `${coverageDir}`); shell.cp('-R', `${workingDir}/migrations`, `${coverageDir}`);
const truffleConfig = reqCwd(`${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: copy truffle.js whole to coverage environment
if (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`); shell.cp(`${workingDir}/truffle.js`, `${coverageDir}/truffle.js`);
@ -142,21 +142,20 @@ try {
cleanUp(msg + err); cleanUp(msg + err);
} }
// Set testrpc options
const defaultRpcOptions = `--gasLimit ${gasLimitString} --accounts ${accounts} --port ${port}`;
const testrpcOptions = config.testrpcOptions || defaultRpcOptions;
// Run modified testrpc with large block limit, on (hopefully) unused port. // Run modified testrpc with large block limit, on (hopefully) unused port.
// (Changes here should be also be added to the before() block of test/run.js). // (Changes here should be also be added to the before() block of test/run.js).
if (!config.norpc) { if (!config.norpc) {
const defaultRpcOptions = `--gasLimit ${gasLimitString} --accounts ${accounts} --port ${port}`;
const testrpcOptions = config.testrpcOptions || defaultRpcOptions;
const command = './node_modules/.bin/testrpc-sc '; const command = './node_modules/.bin/testrpc-sc ';
testrpcProcess = childprocess.exec(command + testrpcOptions, null, err => { testrpcProcess = childprocess.exec(command + testrpcOptions, null, err => {
if (err) cleanUp('testRpc errored after launching as a childprocess.'); if (err) cleanUp('testRpc errored after launching as a childprocess.');
}); });
log(`Launching testrpc on port ${port}`); log(`Launching testrpc on port ${port}`);
} }
// Run truffle over instrumented contracts in the // Run truffle (or config.testCommand) over instrumented contracts in the
// coverage environment folder. Shell cd command needs to be invoked // coverage environment folder. Shell cd command needs to be invoked
// as its own statement for command line options to work, apparently. // as its own statement for command line options to work, apparently.
try { try {

Loading…
Cancel
Save