-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: husky and add tests * style: indent
- Loading branch information
Showing
7 changed files
with
80 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
. test/functions.sh | ||
setup | ||
install | ||
|
||
npx --no-install husky | ||
expect_hooksPath_to_be ".husky/_" | ||
|
||
git add package.json | ||
echo "echo \"pre-commit\"" >.husky/pre-commit | ||
|
||
# Should not fail if set -u is used | ||
mkdir -p config/husky | ||
echo "set -u" > config/husky/init.sh | ||
XDG_CONFIG_HOME="$(pwd)/config" expect 0 "git commit -m foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
. test/functions.sh | ||
setup | ||
install | ||
|
||
# Should not setup hooks when HUSKY=0 | ||
HUSKY=0 npx --no-install husky | ||
expect_hooksPath_to_be "" | ||
# Should setup hooks | ||
npx --no-install husky | ||
expect_hooksPath_to_be ".husky/_" | ||
# Should not commit | ||
git add package.json | ||
echo "echo \"pre-commit\" && exit 1" >.husky/pre-commit | ||
expect 1 "git commit -m foo" | ||
|
||
# Should commit when HUSKY=0 | ||
mkdir -p config/husky | ||
echo "export HUSKY=0" > config/husky/init.sh | ||
XDG_CONFIG_HOME="$(pwd)/config" expect 0 "git commit -m foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
setup | ||
install | ||
|
||
# Test init command | ||
expect 0 "npx --no-install husky init" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters