Skip to content

Instantly share code, notes, and snippets.

@djanowski djanowski/autotest
Last active Feb 1, 2016

Embed
What would you like to do?
ag -l + entr = autotest!
#!/usr/bin/env bash
# Monitors your tree and runs tests when anything changes.
#
# Run `make`, `npm 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=${@:-npm 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 | entr -rcd sh -c "$BUILD"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.