Skip to content

Commit a3db0d3

Browse files
committedSep 21, 2020
chore(test): improve output
1 parent 6fec087 commit a3db0d3

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"postversion": "git push && git push --tags && npm publish --tag next",
4141
"prepublish": "pinst --disable",
4242
"postpublish": "pinst --enable",
43-
"pretest": "npm run build && npm pack",
43+
"pretest": "npm run build --silent && npm pack --silent",
4444
"test": "sh ./test/default.sh && sh ./test/subdir.sh",
4545
"posttest": "rm husky-*.tgz",
4646
"commit": "commit"

‎test/_functions.sh

+9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Exit on error
22
set -eu
33

4+
function title {
5+
echo
6+
echo "-------------------"
7+
echo "+ $1"
8+
echo "-------------------"
9+
echo
10+
}
11+
412
# Create $1 and install tgz
513
function install_tgz {
14+
# generated by pretest script
615
tgz="./husky-*.tgz"
716

817
# Create directory

‎test/default.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
. $(dirname $0)/_functions.sh
22

3+
title "default"
4+
35
tempDir=/tmp/pre-commit-test
46

57
rm -rf $tempDir
@@ -21,4 +23,4 @@ npx --no-install husky add pre-commit "echo \"msg from pre-commit hook\" && exit
2123

2224
# Test pre-commit
2325
git add package.json
24-
git commit -m "should fail" || echo -e "\e[0;32msuccess :)\e[m" && exit 0
26+
git commit -m "should fail" || echo -e "\e[0;32mSUCCESS\e[m" && exit 0

‎test/subdir.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
. $(dirname $0)/_functions.sh
22

3+
title "subdir"
4+
35
rootDir="/tmp/pre-commit-sub"
46
subDir="$rootDir/sub"
57

@@ -31,4 +33,4 @@ npx --no-install husky add pre-commit "echo \"msg from pre-commit hook\" && exit
3133

3234
# Test pre-commit
3335
git add package.json
34-
git commit -m "should fail" || echo -e "\e[0;32msuccess :)\e[m" && exit 0
36+
git commit -m "should fail" || echo -e "\e[0;32mSUCCESS\e[m" && exit 0

0 commit comments

Comments
 (0)
Please sign in to comment.