Skip to content

Commit

Permalink
test: set/add commands
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Mar 21, 2021
1 parent d3cadef commit b5e00f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"preversion": "npm run build",
"postversion": "git push && git push --tags && npm publish",
"pretest": "npm run build --silent && npm pack --silent",
"test": "sh ./test/init.sh && sh ./test/init-yarn-2.sh && sh ./test/default.sh && sh ./test/sub-dir.sh && sh ./test/config-dir.sh && sh ./test/not-git-dir.sh",
"test": "sh ./test/init.sh && sh ./test/init-yarn-2.sh && sh ./test/default.sh && sh ./test/sub-dir.sh && sh ./test/config-dir.sh && sh ./test/not-git-dir.sh && sh ./test/set-add.sh",
"posttest": "rm husky-*.tgz",
"commit": "commit"
},
Expand Down
24 changes: 24 additions & 0 deletions test/set-add.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# shellcheck shell=bash

# shellcheck source=./_functions.sh
. "$(dirname "$0")/_functions.sh"

title "set add"
tempDir="/tmp/husky-set-add"
f=".husky/pre-commit"

rm -rf $tempDir
cd_and_install_tgz $tempDir

init_git
npx --no-install husky install

npx --no-install husky add $f "foo"
grep -m 1 _ $f && grep foo $f && ok

npx --no-install husky add .husky/pre-commit "bar"
grep -m 1 _ $f && grep foo $f && grep bar $f && ok

npx --no-install husky set .husky/pre-commit "baz"
grep -m 1 _ $f && grep foo $f || grep bar $f || grep baz $f && ok

0 comments on commit b5e00f2

Please sign in to comment.