-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for fit, fdescribe or .only in tests
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
SRC=$(git rev-parse --show-toplevel) | ||
EXCLUDE="--exclude-dir 'node_modules' --exclude-dir '.git'" | ||
|
||
#========================================================== | ||
# Check if I forgot to remove 'only' keyword from tests. | ||
# To make sure that before commit run all tests | ||
only_command="grep -c -h -r $EXCLUDE -E \"(describe|it)\.only\" $SRC | awk -F ':' '{x +=\$0}; END {print x}'" | ||
fonly_command="grep -c -h -r $EXCLUDE -E \"f(it|describe)\(\" $SRC | awk -F ':' '{x +=\$0}; END {print x}'" | ||
only=`eval $only_command` | ||
fonly=`eval $fonly_command` | ||
|
||
if (( $((only + fonly)) > 0 )) | ||
then | ||
echo 'Remove ONLY from tests.' | ||
# Output list of found only entries | ||
eval "grep -r -n $EXCLUDE -E \"(describe|it)\.only\" $SRC" | ||
eval "grep -r -n $EXCLUDE -E \"f(it|describe)\(\" $SRC" | ||
exit 1 | ||
fi |