Created
May 5, 2021 12:24
-
-
Save chrisvoo/03f937314d89765b6a1214901bbdaab5 to your computer and use it in GitHub Desktop.
Avoit to commit tests with `only`
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
# Redirect output to stderr. | |
exec 1>&2 | |
# prevent it.only or describe.only commited | |
if [ "$allowonlytests" != "true" ] && | |
test $(git diff --cached | grep -E "\b(it|describe).only\(" | wc -l) != 0 | |
then | |
cat <<\EOF | |
Error: Attempt to add it.only or describe.only - which may disable all other tests | |
If you know what you are doing you can disable this check using: | |
git config hooks.allowonlytests true | |
EOF | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment