Skip to content

Instantly share code, notes, and snippets.

@lennym
Created October 25, 2012 16:17
Show Gist options
  • Save lennym/3953769 to your computer and use it in GitHub Desktop.
Save lennym/3953769 to your computer and use it in GitHub Desktop.
Run test pre-commit hooks
git stash -q --keep-index
if phantomjs ; then
echo "Running Jasmine unit tests"
if [ "$DEBUG" = "true" ] ; then
phantomjs src/test/phantom.runner.js src/test/index.html 8080 true
else
phantomjs src/test/phantom.runner.js src/test/index.html 8080 false
fi
RESULT=$?
else
echo "phantomjs is not installed. Skipping tests."
RESULT=0
fi
git stash pop -q
sudo chmod 777 . -R
FAIL=1
if [ "$RESULT" = "$FAIL" ] ; then
echo "Tests failed - aborting commit"
echo "To see test output do 'DEBUG=true git commit'"
fi
exit $RESULT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment