Created
October 25, 2012 16:17
-
-
Save lennym/3953769 to your computer and use it in GitHub Desktop.
Run test pre-commit hooks
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
| 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