Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
PATH_TO_VISUAL_TESTS=src/test/visual/spec/*Spec.js
NEWLINE=$'\n'
OUTPUT=""
function checkFileFor {
visualTestFile=$1
value=$2
contains=$(cat ${visualTestFile} | grep -vE "([[:space:]]*)//([[:space:]]*)${value}" | grep -nE "${value}")
if [ -n "$contains" ]; then
echo "${NEWLINE}${NEWLINE}Visual test ${visualTestFile} contains $value:${NEWLINE}${contains}"
fi
}
for visualTestFile in ${PATH_TO_VISUAL_TESTS}
do
OUTPUT=${OUTPUT}$(checkFileFor ${visualTestFile} "ddescribe")
OUTPUT=${OUTPUT}$(checkFileFor ${visualTestFile} "iit")
OUTPUT=${OUTPUT}$(checkFileFor ${visualTestFile} "pause\(\)\;")
done
if [ -n "$OUTPUT" ]; then
echo "Fatal Errors Found in Visual Tests${OUTPUT}"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment