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.

Revisions

  1. andreisebastianc created this gist Jul 18, 2016.
    25 changes: 25 additions & 0 deletions pre-commit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # 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