Created
February 2, 2015 10:14
-
-
Save mebibou/554f3563bdc4c8bb624f to your computer and use it in GitHub Desktop.
npm test pre-push on dev branch
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 | |
# pre-push git hook. | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
pass=true | |
if [ $current_branch = "dev" ]; then | |
npm test | |
if [ $? != 0 ]; then | |
pass=false | |
fi | |
fi | |
if $pass; then | |
exit 0 | |
else | |
echo "" | |
echo "PUSH FAILED:" | |
echo "Some tests fail. Please fix them and try pushing again." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment