Skip to content

Instantly share code, notes, and snippets.

@alediaferia
Last active August 29, 2015 14:23
Show Gist options
  • Save alediaferia/60a2b492b90372674d25 to your computer and use it in GitHub Desktop.
Save alediaferia/60a2b492b90372674d25 to your computer and use it in GitHub Desktop.
Prevent committing `iit` Protractor (https://github.com/angular/protractor) test suites
#!/bin/bash
# checking if unadvertedly we have left iit here and
# there in protractor test files
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
for i in `git diff-index --name-only $against --` ; do
suffix=${i##*.}
if [ "js" -eq "$suffix" ] && [ "grep -E \"^\s*(x|i)it\(\'\" $i" ]; then
echo $i " still contains 'iit' or 'xit' directives. Remove them before committing"
exit 1
fi
done
exit
@alediaferia
Copy link
Author

  1. Place the content of this gist inside .git/hooks/ and name it pre-commit
  2. chmod +x .git/hooks/pre-commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment