#!/bin/bash
wait_port() {
local RC=1;
while [ $RC -ne 0 ]; do
curl -s --max-time "$1" "$2" > /dev/null;
RC=$?;
done
}
trap "exit" INT TERM SIGINT SIGTERM
trap "kill 0" EXIT
yarn start &
echo "waiting 60s for localhost:3000 to open..."
wait_port 60 localhost:3000
echo "localhost:3000 responded, running tests."
yarn test:integration:run