Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Run testsuite quickly in browser
#!/bin/bash
library=$1
suite=$2
coverage=$3
if [ ! -d ui/$library ]; then
echo "Directory ui/$library does not exist"
exit 1
fi
if [[ $coverage == "coverage" ]] || [[ $suite == "coverage" ]]; then
echo "Running with coverage turned on"
coverage="?coverage=true"
fi
if [[ $suite == "bit" ]] || [[ $suite == "unit" ]]; then
echo "Running" $suite "tests"
else
echo "Defaulting to unit tests, available test suites: [unit,bit]"
suite="unit"
fi
killall node &> /dev/null
cd ui/$library
cdt2 serve &> /dev/null &
sleep 2
google-chrome --app=http://localhost:8585/test/$suite/$coverage --user-data-dir=/tmp/google-chrome-unittest &> /dev/null &
wait $!
killall node &> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment