Skip to content

Instantly share code, notes, and snippets.

@andreisebastianc
Created July 18, 2016 12:27
Show Gist options
  • Save andreisebastianc/abc7e7e5bcaec990fe96b6a3c68a0bb9 to your computer and use it in GitHub Desktop.
Save andreisebastianc/abc7e7e5bcaec990fe96b6a3c68a0bb9 to your computer and use it in GitHub Desktop.
Pre-commit git hook for running tests
# 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