Test command runs after TestRPC starts listening

pull/67/head
Alan Lu 7 years ago
parent 96430f727d
commit d37bab42db
  1. 13
      bin/exec.js

@ -146,6 +146,7 @@ try {
cleanUp(msg + err);
}
new Promise((resolve, reject) => {
// 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) {
@ -156,9 +157,16 @@ if (!config.norpc) {
testrpcProcess = childprocess.exec(command + testrpcOptions, null, err => {
if (err) cleanUp('testRpc errored after launching as a childprocess.');
});
log(`Launching testrpc on port ${port}`);
testrpcProcess.stdout.on('data', data => {
if (data.includes('Listening')) {
log(`Launched testrpc on port ${port}`);
return resolve();
}
});
} else {
return resolve();
}
}).then(() => {
// 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.
@ -214,3 +222,4 @@ try {
// Finish
cleanUp();
});

Loading…
Cancel
Save