Last active
August 30, 2016 10:25
-
-
Save viruschidai/31e4d2208d8a44b80a36 to your computer and use it in GitHub Desktop.
git pre-commit hook to check if '.skip' or '.only' is used in mocha 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
filelist=$(git diff --cached --name-only --diff-filter=ACMR) | |
testfiles=$(echo "${filelist[@]}" | grep -E 'test\/.*\.coffee$' | grep -v node_modules) | |
if [[ ${testfiles[@]} ]] | |
then | |
echo | |
echo 'Checking if there are skipped tests ...' | |
echo | |
echo ${testfiles[@]} | xargs cat | grep -E '\.only|\.skip' && echo 'Error: contains skipped tests' && exit 1 || exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment