Skip to content

Instantly share code, notes, and snippets.

@lluft
lluft / pre-commit
Last active October 14, 2015 21:34 — forked from holyjak/pre-commit
Git pre-commit hook that fails for changes introducing Jasmine's exclusive tests using "ddescribe" or "iit"
#!/bin/sh
# A git pre-commit hook that verifies that the change does not introduce
# the use of a Jasmine exclusive test via 'iit(..)' or 'ddescribe(..)', which would
# prevent most other tests from being run without any clear indication thereof
# Redirect output to stderr.
exec 1>&2
ADDED_EXCLUSIVE_TEST=$(git diff -U0 --staged -S"(\W|^)(ddescribe|iit))\s+?\(" --pickaxe-regex | egrep "(^\+.*(ddescribe|iit))|\+{3}")