From: Dan Vanderkam Date: Mon, 30 Mar 2015 19:26:06 +0000 (-0400) Subject: Ensure .only() is never committed X-Git-Tag: v2.0.0~63^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftest-warnings;p=dygraphs.git Ensure .only() is never committed --- 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