Skip to content

Instantly share code, notes, and snippets.

@ftokarev
Created March 8, 2014 08:36
Show Gist options
  • Save ftokarev/9427408 to your computer and use it in GitHub Desktop.
Save ftokarev/9427408 to your computer and use it in GitHub Desktop.
Git pre-commit hook for qunit-karma-launch
#!/bin/bash
#
# Check, whether tests contain omodule, otest
#
TESTDIR='./tests'
INTEGRATION="$TESTDIR/integration"
UNIT="$TESTDIR/unit"
MATCHES=( $(rgrep -El 'omodule|otest' $UNIT $INTEGRATION) )
if [ ! ${#MATCHES[@]} -eq 0 ]
then
echo "Error: attempt to commit tests containing omodule/otest"
echo ""
echo "Offending files:"
for file in "${MATCHES[@]}"
do
echo " ${file}"
done
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment