Skip to content

Instantly share code, notes, and snippets.

@willread
Last active December 25, 2015 15:19
Show Gist options
  • Save willread/6997271 to your computer and use it in GitHub Desktop.
Save willread/6997271 to your computer and use it in GitHub Desktop.
Pre-commit test running via git hooks and npm.
#!/usr/bin/env bash
NUM_ERRORS=`npm test | grep -c ERR`
if [ $NUM_ERRORS -ne 0 ]
then
echo -e "One or more tests failed, commit aborted"
exit 1
else
echo -e "All tests passed, proceeding with commit"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment