Created
February 14, 2024 19:20
-
-
Save hankadev/b7ff6bc63fb99dec62fd74b2e706b4d6 to your computer and use it in GitHub Desktop.
a simple script for pre-commit hook that checks if I forgot to remove .only from a test case
This file contains hidden or 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
| #!/bin/bash | |
| # pre-commit.sh | |
| for file in $(git diff --cached --name-only | grep -E '\.(js|jsx|ts|tsx)$'); do | |
| if grep -q ".only(" "$file"; then | |
| echo "Error: '.only(' found in $file" | |
| exit 1 | |
| fi | |
| done | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment