add husky and pre-commit hook to run tests

This commit is contained in:
Daniel Waxweiler 2021-12-09 18:14:05 +01:00
parent 8d4735f138
commit fad14485bd
3 changed files with 28 additions and 0 deletions

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm test

22
package-lock.json generated
View File

@ -23,6 +23,7 @@
"esm": "^3.2.25", "esm": "^3.2.25",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-replace": "^1.1.3", "gulp-replace": "^1.1.3",
"husky": "^7.0.4",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"webpack": "^5.65.0", "webpack": "^5.65.0",
@ -4923,6 +4924,21 @@
"node": ">=10.17.0" "node": ">=10.17.0"
} }
}, },
"node_modules/husky": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz",
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
"dev": true,
"bin": {
"husky": "lib/bin.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/typicode"
}
},
"node_modules/iconv-lite": { "node_modules/iconv-lite": {
"version": "0.6.3", "version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
@ -13600,6 +13616,12 @@
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
"dev": true "dev": true
}, },
"husky": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz",
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
"dev": true
},
"iconv-lite": { "iconv-lite": {
"version": "0.6.3", "version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",

View File

@ -9,6 +9,7 @@
"clean": "rimraf -- build", "clean": "rimraf -- build",
"coverage": "c8 --all --reporter=html --reporter=text --include=source/**/*.js ava", "coverage": "c8 --all --reporter=html --reporter=text --include=source/**/*.js ava",
"eslint": "npx eslint source/**/*.js", "eslint": "npx eslint source/**/*.js",
"prepare": "husky install",
"test": "ava" "test": "ava"
}, },
"author": { "author": {
@ -35,6 +36,7 @@
"esm": "^3.2.25", "esm": "^3.2.25",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-replace": "^1.1.3", "gulp-replace": "^1.1.3",
"husky": "^7.0.4",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"webpack": "^5.65.0", "webpack": "^5.65.0",