Last active
August 29, 2015 14:03
-
-
Save briansorahan/4a90818f724d9f4a0980 to your computer and use it in GitHub Desktop.
Running jshint and npm test in pre-commit git hook
This file contains hidden or 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
#/bin/sh | |
# | |
# ... | |
# | |
# The pre-commit.sample template prefixes `git diff-index` with exec. | |
# This is a convenient way to make pre-commit exit with the status of this | |
# command, but we need to strip the exec prefix if we want to run other commands | |
# after git diff-index. | |
# | |
git diff-index --check --cached $against -- || exit 1 | |
# Pass through the linter | |
jshint *.js || exit 1 | |
# Run tests | |
npm test || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment