From 1f98bcecd139fce89023e4f954df9941cb04de39 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 30 Mar 2015 15:26:06 -0400 Subject: [PATCH] Ensure .only() is never committed --- package.json | 9 +++++++-- scripts/check-no-only.sh | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 scripts/check-no-only.sh diff --git a/package.json b/package.json index de85acc..82d961b 100644 --- a/package.json +++ b/package.json @@ -52,10 +52,15 @@ "obvious-closure-library": "^20140401.0.2", "parse-data-uri": "^0.2.0", "phantomjs": "^1.9.7-8", + "pre-commit": "^1.0.6", "source-map": "^0.4.2", "uglify-js": "^2" }, "scripts": { - "test": "make test" - } + "test": "make test", + "tests-ok": "./scripts/check-no-only.sh" + }, + "pre-commit": [ + "tests-ok" + ] } diff --git a/scripts/check-no-only.sh b/scripts/check-no-only.sh new file mode 100755 index 0000000..0977ec1 --- /dev/null +++ b/scripts/check-no-only.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Checks that no ".only" has made it into tests. This should never be commited, +# since it will disable the vast majority of tests. + +if grep -R '\.only(' auto_tests/tests; then + echo 'Remove .only from tests before committing.' + exit 1 +fi + +exit 0 -- 2.7.4