Skip to content

Stop crashing on encounters with non-truffle projects #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions bin/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ try {
shell.cp('-R', `${workingDir}/test`, `${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
if (truffleConfig.networks.coverage) {
if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) {
port = truffleConfig.networks.coverage.port || port;
shell.cp(`${workingDir}/truffle.js`, `${coverageDir}/truffle.js`);

Expand Down Expand Up @@ -142,21 +142,20 @@ try {
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.
// (Changes here should be also be added to the before() block of test/run.js).
if (!config.norpc) {
const defaultRpcOptions = `--gasLimit ${gasLimitString} --accounts ${accounts} --port ${port}`;
const testrpcOptions = config.testrpcOptions || defaultRpcOptions;
const command = './node_modules/.bin/testrpc-sc ';

testrpcProcess = childprocess.exec(command + testrpcOptions, null, err => {
if (err) cleanUp('testRpc errored after launching as a childprocess.');
});
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
// as its own statement for command line options to work, apparently.
try {
Expand Down