Skip to content

Instantly share code, notes, and snippets.

@schmidsi
Last active May 22, 2017 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmidsi/bc106f6f2b9571a15a3c8e3a58457df1 to your computer and use it in GitHub Desktop.
Save schmidsi/bc106f6f2b9571a15a3c8e3a58457df1 to your computer and use it in GitHub Desktop.
Simple node.js script that can start meteor and wait until it is loaded to run chimp tests
// Inspired from: https://github.com/xolvio/qualityfaster/blob/master/.scripts/
import { exec } from 'child_process';
const meteorCommand = process.argv[2];
const chimpCommand = process.argv[3];
const meteorProcess = exec(meteorCommand); // 'npm start'
meteorProcess.stdout.pipe(process.stdout);
meteorProcess.stderr.pipe(process.stderr);
// Wait until Meteor is started and the start the chimp tests
meteorProcess.stdout.on('data', (data) => {
if (data.toString().match('App running at')) {
const chimpProcess = exec(chimpCommand); // 'npm run test:chimp:phantomjs'
chimpProcess.stdout.pipe(process.stdout);
chimpProcess.stderr.pipe(process.stderr);
chimpProcess.on('close', (code) => {
console.log(`Chimp exited with code ${code}`);
meteorProcess.kill();
process.exit(code);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment