Skip to content

Instantly share code, notes, and snippets.

@mikepaszkiewicz
Created April 18, 2022 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikepaszkiewicz/d58a7c01a4fb8594d40ee29347fdc07c to your computer and use it in GitHub Desktop.
Save mikepaszkiewicz/d58a7c01a4fb8594d40ee29347fdc07c to your computer and use it in GitHub Desktop.
Scan mocha directory for it.only, fail pre-commit hook
#!/bin/bash
# Scans /tests directory for instances of 'it.only',
# If found, cancel commit and log files that need to be fixed.
TEST_ERRORS=$(grep -s it.only ../tests/*/** | wc -l)
echo "Verifying all tests are enabled...";
if [ $TEST_ERRORS -gt 0 ]
then
echo "Remove it.only from tests"
grep -s it.only ../tests/*/**
exit 1
else
echo "All tests are enabled!"
cd ..;
exit 0;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment