Ensure .only() is never committed test-warnings
authorDan Vanderkam <danvdk@gmail.com>
Mon, 30 Mar 2015 19:26:06 +0000 (15:26 -0400)
committerDan Vanderkam <danvdk@gmail.com>
Mon, 30 Mar 2015 19:26:06 +0000 (15:26 -0400)
package.json
scripts/check-no-only.sh [new file with mode: 0755]

index de85acc..82d961b 100644 (file)
     "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 (executable)
index 0000000..0977ec1
--- /dev/null
@@ -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