To check if a test is flaky, there's often no other way than to run it multiple times.
I have a Bash function in my .bashrc to do this for me:
times 10 npm t
This will run npm t up to 10 times but it will stop immediately if one of the test runs fails.
Feel free to copy it to your .bashrc or .bash_profile:
BASH
times() {n=$1shiftecho $@while [[ $n -gt 0 ]]; do if "$@"; then n=$((n-1)); else break; fi; done}