@@ -135,65 +135,86 @@ test('should produce no error output with -q flag', async t => {
135135 t . is ( actual . code , 1 ) ;
136136} ) ;
137137
138- test ( 'should work with husky commitmsg hook and git commit' , async ( ) => {
139- const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
140- await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e` } } , { cwd} ) ;
141-
142- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
143- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
144- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
145- } ) ;
146-
147- test ( 'should work with husky commitmsg hook in sub packages' , async ( ) => {
148- const upper = await git . bootstrap ( 'fixtures/husky' ) ;
149- const cwd = path . join ( upper , 'integration' ) ;
150- await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e` } } , { cwd : upper } ) ;
151-
152- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
153- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
154- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
155- } ) ;
156-
157- test ( 'should work with husky via commitlint -e $GIT_PARAMS' , async ( ) => {
158- const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
159- await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e $GIT_PARAMS` } } , { cwd} ) ;
160-
161- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
162- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
163- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
164- } ) ;
165-
166- test ( 'should work with husky via commitlint -e %GIT_PARAMS%' , async ( ) => {
167- const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
168- await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e %GIT_PARAMS%` } } , { cwd} ) ;
169-
170- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
171- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
172- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
173- } ) ;
174-
175- test ( 'should work with husky via commitlint -e $HUSKY_GIT_PARAMS' , async ( ) => {
176- const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
177- await writePkg (
178- { scripts : { commitmsg : `'${ bin } ' -e $HUSKY_GIT_PARAMS` } } ,
179- { cwd}
180- ) ;
181-
182- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
183- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
184- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
185- } ) ;
186-
187- test ( 'should work with husky via commitlint -e %HUSKY_GIT_PARAMS%' , async ( ) => {
188- const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
189- await writePkg (
190- { scripts : { commitmsg : `'${ bin } ' -e %HUSKY_GIT_PARAMS%` } } ,
191- { cwd}
192- ) ;
193-
194- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
195- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
196- await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
138+ test ( 'should work with husky commitmsg hook and git commit' , async t => {
139+ await t . notThrowsAsync ( async ( ) => {
140+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
141+ await writePkg ( { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e` } } } , { cwd} ) ;
142+
143+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
144+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
145+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
146+ } ) ;
147+ } ) ;
148+
149+ test ( 'should work with husky commitmsg hook in sub packages' , async t => {
150+ await t . notThrowsAsync ( async ( ) => {
151+ const upper = await git . bootstrap ( 'fixtures/husky' ) ;
152+ const cwd = path . join ( upper , 'integration' ) ;
153+ await writePkg (
154+ { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e` } } } ,
155+ { cwd : upper }
156+ ) ;
157+
158+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
159+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
160+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
161+ } ) ;
162+ } ) ;
163+
164+ test ( 'should work with husky via commitlint -e $GIT_PARAMS' , async t => {
165+ await t . notThrowsAsync ( async ( ) => {
166+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
167+ await writePkg (
168+ { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e $GIT_PARAMS` } } } ,
169+ { cwd}
170+ ) ;
171+
172+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
173+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
174+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
175+ } ) ;
176+ } ) ;
177+
178+ test ( 'should work with husky via commitlint -e %GIT_PARAMS%' , async t => {
179+ await t . notThrowsAsync ( async ( ) => {
180+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
181+ await writePkg (
182+ { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e %GIT_PARAMS%` } } } ,
183+ { cwd}
184+ ) ;
185+
186+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
187+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
188+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
189+ } ) ;
190+ } ) ;
191+
192+ test ( 'should work with husky via commitlint -e $HUSKY_GIT_PARAMS' , async t => {
193+ await t . notThrowsAsync ( async ( ) => {
194+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
195+ await writePkg (
196+ { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e $HUSKY_GIT_PARAMS` } } } ,
197+ { cwd}
198+ ) ;
199+
200+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
201+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
202+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
203+ } ) ;
204+ } ) ;
205+
206+ test ( 'should work with husky via commitlint -e %HUSKY_GIT_PARAMS%' , async t => {
207+ await t . notThrowsAsync ( async ( ) => {
208+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
209+ await writePkg (
210+ { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e %HUSKY_GIT_PARAMS%` } } } ,
211+ { cwd}
212+ ) ;
213+
214+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
215+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
216+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
217+ } ) ;
197218} ) ;
198219
199220test ( 'should allow reading of environment variables for edit file, succeeding if valid' , async t => {
@@ -269,18 +290,20 @@ test('should pick up config from inside git repo with precedence and fail accord
269290 t . is ( actual . code , 1 ) ;
270291} ) ;
271292
272- test ( 'should handle --amend with signoff' , async ( ) => {
273- const cwd = await git . bootstrap ( 'fixtures/signoff' ) ;
274- await writePkg ( { scripts : { commitmsg : `'${ bin } ' -e` } } , { cwd} ) ;
275-
276- await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
277- await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
278- await execa (
279- 'git' ,
280- [ 'commit' , '-m' , '"test: this should work"' , '--signoff' ] ,
281- { cwd}
282- ) ;
283- await execa ( 'git' , [ 'commit' , '--amend' , '--no-edit' ] , { cwd} ) ;
293+ test ( 'should handle --amend with signoff' , async t => {
294+ await t . notThrowsAsync ( async ( ) => {
295+ const cwd = await git . bootstrap ( 'fixtures/signoff' ) ;
296+ await writePkg ( { husky : { hooks : { 'commit-msg' : `'${ bin } ' -e` } } } , { cwd} ) ;
297+
298+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
299+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
300+ await execa (
301+ 'git' ,
302+ [ 'commit' , '-m' , '"test: this should work"' , '--signoff' ] ,
303+ { cwd}
304+ ) ;
305+ await execa ( 'git' , [ 'commit' , '--amend' , '--no-edit' ] , { cwd} ) ;
306+ } ) ;
284307} ) ;
285308
286309test ( 'should handle linting with issue prefixes' , async t => {
0 commit comments