Last active
May 22, 2017 13:08
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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