Created
July 18, 2016 12:27
-
-
Save andreisebastianc/abc7e7e5bcaec990fe96b6a3c68a0bb9 to your computer and use it in GitHub Desktop.
Pre-commit git hook for running tests
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
# Redirect output to stderr. | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
exec 1>&2 | |
git stash -q --keep-index | |
echo "Running tests..." | |
TEST_OUTPUT="$(ember test)" | |
RESULT=$? | |
git stash pop -q | |
if [ "$RESULT" = "0" ]; | |
then | |
echo -e "${GREEN}Tests: OK${NC}" | |
exit 0 | |
else | |
echo "${TEST_OUTPUT}" | |
echo -e "${RED}Tests: FAILING${NC}" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment