Skip to content

Instantly share code, notes, and snippets.

@O5ten
Last active July 6, 2016 07:54
Show Gist options
  • Save O5ten/93d7de2ef062b11210a71a67e012f76a to your computer and use it in GitHub Desktop.
Save O5ten/93d7de2ef062b11210a71a67e012f76a to your computer and use it in GitHub Desktop.
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