Created
January 17, 2012 10:30
-
-
Save Stubbs/1626139 to your computer and use it in GitHub Desktop.
pre-commit hook to stop you commiting broken tests.
This file contains 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
#!/bin/sh | |
# Script to check the status of the last test run & cancel the commit if there are any errors or failures | |
RESULTS="tests/reports/testsuites.xml" | |
# Check the test results exist, and have results in them. | |
if [ ! -s $RESULTS ] | |
then | |
echo "WTF is this shit? You've not even tried to run the tests. You suck, man." | |
exit 1 | |
fi | |
if grep 'errors="[1-9]\+"' $RESULTS | |
then | |
echo "There are unit test errors, ALL ERRORS MUST DIE!!" | |
exit 1 | |
fi | |
if grep 'failues="[1-9]\+"' $RESULTS | |
then | |
echo "There are test failures ... you've not just let yourself down, but you've let me down too." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L20: 'failues' ?