Skip to content

Instantly share code, notes, and snippets.

@kimniche
Created December 12, 2016 14:58
Show Gist options
  • Select an option

  • Save kimniche/4c0493c4c09db55f7e143740e1a3687a to your computer and use it in GitHub Desktop.

Select an option

Save kimniche/4c0493c4c09db55f7e143740e1a3687a to your computer and use it in GitHub Desktop.
#!/bin/bash
# First confirm we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
exit 0
fi
# Get OX-specific test command
# Assume not Mac OSX by default
CMD="npm run test:nowatch-win"
if [[ $OSTYPE == darwin* ]]; then
CMD="npm run test:nowatch"
fi
echo "[pre-push] Running tests with \`$CMD\`"
$CMD
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "[pre-push] Some tests failed, not pushing"
exit 1
fi
# Exit status code 1 is error and will prevent push
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment