Skip to content

Running unit tests before every git push

Brett Bukowski edited this page Nov 29, 2016 · 2 revisions

Save the following to your repo's .git/hooks/pre-push file:

#!/bin/sh
printf "Starting Unit Tests\n"

npm run test

testResults=$?
if [ $testResults -eq 1 ]
then
    echo -e "\n Tests FAILED\n\n push ABORTED"
    exit 1
fi
exit 0
Clone this wiki locally