Skip to content

Instantly share code, notes, and snippets.

@Rochdy
Last active May 20, 2023 20:45
Show Gist options
  • Save Rochdy/c2f850a0be21c65806e669f7ceaaff8a to your computer and use it in GitHub Desktop.
Save Rochdy/c2f850a0be21c65806e669f7ceaaff8a to your computer and use it in GitHub Desktop.
Alert upon tests output
#!/bin/bash
#Change the test command as your app usage
output="$(npm test)"
cat <<< "${output}"
# Instead of failing you can place a word that appears if tests failed
if grep failing <<< "${output}" > /dev/null; then
#Im using sox/play, you can use vlc or any audio player..
play https://www.roshdy.dev/assets/f-test.mp3
# Instead of passing you can place a word that appears if tests passed
elif grep passing <<< "${output}" > /dev/null; then
play https://www.roshdy.dev/assets/s-test.mp3
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment