Created
January 13, 2017 22:28
-
-
Save djanowski/00fb5cee0bedc6b65a721e9694388bf8 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Monitors your tree and runs tests when anything changes. | |
# | |
# `make`, `yarn test`, etc. automatically detected. | |
# | |
# $ autotest | |
# | |
# Run a specific command on changes: | |
# | |
# $ autotest mocha test/foo_test.js | |
# | |
trap exit INT | |
if [[ -f package.json ]]; then | |
BUILD=${@:-yarn test} | |
elif [[ -f Makefile ]]; then | |
BUILD=${@:-make} | |
else | |
echo "Don't know what command to run. Try: autotest [command]" >&2 | |
exit 1 | |
fi | |
while true; do | |
ag -l | td entr -rd sh -c "echo ===; $BUILD" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment