Created
December 9, 2015 14:47
-
-
Save stollcri/f33a8e9651cf75d2ca28 to your computer and use it in GitHub Desktop.
Start Node.js and wait for it to be running, then run Mocha.js tests
This file contains hidden or 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
# start node, silence output, and send to the background | |
npm start > /dev/null & | |
# give node a chance to start | |
if [ -f "$(which curl)" ]; then | |
LOOP_PASS=0 | |
TEST_STAT="999" | |
# wait (maximum 15 seconds) until node is ready | |
while [ "$TEST_STAT" != "200" -a $LOOP_PASS -lt 15 ]; do | |
CURL_STAT=$(curl -sI http://localhost) | |
TEST_STAT=$(echo $CURL_STAT | head -n1 | awk '{print $2}') | |
((LOOP_PASS++)) | |
sleep 1 | |
done | |
else | |
sleep 5 | |
fi | |
# run the test suite | |
npm run mocha-test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment