Created
January 8, 2018 15:13
-
-
Save willmorgan/89682dbebe3e5260a87a9a999d1f569b to your computer and use it in GitHub Desktop.
Checks for accidental .only blocks inside tests
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
set +e | |
# Check for accidental `.only` blocks inside tests, and fail the tests if any are found: | |
ACCIDENTAL_ONLY=$(grep -R -m 1 --include="*.js" --exclude-dir=node_modules --exclude-dir=.git "\.only" . 2>&1) | |
HAS_ACCIDENTAL_ONLY=$? | |
set -e | |
if [ $HAS_ACCIDENTAL_ONLY == 0 ]; | |
then | |
echo "Found a \`.only\` block inside the tests; failing CI build. Details below:" | |
echo ${ACCIDENTAL_ONLY} | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment