diff --git a/package.json b/package.json index f67253e..91243a4 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "dist": "npm run bundle && npm run minify", "build-all": "npm run docs && npm run build && npm run dist && npm run rollup", "prepare": "npm run build-all", + "precommit": "npm test", "prepublishOnly": "npm test && npm run build-all", "test": "npm run flow && mocha --ui qunit --compilers js:babel-register" }, @@ -49,6 +50,7 @@ "co": "^4.6.0", "documentation": "^4.0.0-rc.1", "flow-bin": "^0.46.0", + "husky": "^0.14.1", "mocha": "^2.4.5", "rollup": "^0.43.0", "rollup-plugin-async": "^1.2.0", diff --git a/pre-commit-hook b/pre-commit-hook deleted file mode 100755 index 63dea59..0000000 --- a/pre-commit-hook +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Redirect output to stderr. -exec 1>&2 - -# If you want to bypass the tests you may set the hooks.ignoretests flag -ignoretests=$(git config --bool hooks.ignoretests) - -if [ "$ignoretests" = "true" ] -then - exit 0 -fi - -# Command to execute -runtest=$(npm run build-all && npm test) -testresult=$? - -# Run tests and raise error on failure, else proceed to commit -if [ $testresult -ne 0 ] -then - cat <<\EOF -Error: One or more tests are failing. - -Please fix the offending code before committing. - -If you know what you are doing you can disable this check using: - - git config hooks.ignoretests true -EOF - exit 1 -fi