File tree 1 file changed +32
-0
lines changed 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -152,5 +152,37 @@ if [ "$exitCode" -eq 0 ]; then
152
152
exit 1
153
153
fi
154
154
155
+ # ---
156
+ test " hook should run and pass all HUSKY_GIT_PARAMS"
157
+ cat > .huskyrc << EOL
158
+ {
159
+ "skipCI": false,
160
+ "hooks": {
161
+ "prepare-commit-msg": "echo \"prepare-commit-msg hook from Husky\" && echo \$ HUSKY_GIT_PARAMS > $hookParamsFile "
162
+ }
163
+ }
164
+ EOL
165
+ if [ -f $hookParamsFile ]; then
166
+ rm $hookParamsFile
167
+ fi
168
+
169
+ commit sixth
170
+
171
+ if [ ! -f $hookParamsFile ]; then
172
+ echo " Fail: hook script didn't run"
173
+ exit 1
174
+ fi
175
+
176
+ actual=$( cat $hookParamsFile )
177
+ expected=" .git/COMMIT_EDITMSG message"
178
+
179
+ if [ " $actual " != " $expected " ]; then
180
+ echo " Fail: HUSKY_GIT_PARAMS weren't set correctly"
181
+ echo " $actual != $expected "
182
+ exit 1
183
+ fi
184
+
155
185
echo
156
186
echo " Success: all tests passed"
187
+
188
+
You can’t perform that action at this time.
0 commit comments