You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usecase: Run a flaky test n number of times to test it if fails. But you can run any command.
#!/bin/sh
if [[ "$1" == "-h" ]]
then
echo "
Usage: repeat-cmd.sh <number of times to repeat> <command to repeat>
Example: repeat-cmd.sh 5 "CI=true npm run test -- SomeComponent.test" -s
-s: Silent mode, does not show any output from the command.
"
exit 0
fi
passed=0
totalTests=$1
i=0
while [ $i -ne $totalTests ]
do
i=$(($i+1))
if [[ "$3" == "-s" ]]
then
eval $2 > /dev/null 2>&1
else
echo "----------------------------------------------"
echo "Test $i/$totalTests"
echo "----------------------------------------------"
eval $2
fi
if [ $? -eq 0 ]
then
passed=$(($passed+1))
echo "Test $i: PASSED"
else
echo "Test $i: FAILED"
fi
done
echo "Passed: $passed / $totalTests"
The text was updated successfully, but these errors were encountered:
Usecase: Run a flaky test n number of times to test it if fails. But you can run any command.
The text was updated successfully, but these errors were encountered: