@@ -171,6 +171,24 @@ test('should work with husky commitmsg hook in sub packages', async () => {
171171 await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
172172} ) ;
173173
174+ test ( 'should work with husky via commitlint -e $GIT_PARAMS' , async ( ) => {
175+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
176+ await writePkg ( { scripts : { commitmsg : `${ bin } -e $GIT_PARAMS` } } , { cwd} ) ;
177+
178+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
179+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
180+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
181+ } ) ;
182+
183+ test ( 'should work with husky via commitlint -e %GIT_PARAMS%' , async ( ) => {
184+ const cwd = await git . bootstrap ( 'fixtures/husky/integration' ) ;
185+ await writePkg ( { scripts : { commitmsg : `${ bin } -e %GIT_PARAMS%` } } , { cwd} ) ;
186+
187+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
188+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
189+ await execa ( 'git' , [ 'commit' , '-m' , '"test: this should work"' ] , { cwd} ) ;
190+ } ) ;
191+
174192test ( 'should pick up parser preset and fail accordingly' , async t => {
175193 const cwd = await git . bootstrap ( 'fixtures/parser-preset' ) ;
176194 const actual = await cli ( [ '--parser-preset' , './parser-preset' ] , { cwd} ) (
@@ -220,6 +238,20 @@ test('should pick up config from inside git repo with precedence and fail accord
220238 t . is ( actual . code , 1 ) ;
221239} ) ;
222240
241+ test ( 'should handle --amend with signoff' , async ( ) => {
242+ const cwd = await git . bootstrap ( 'fixtures/signoff' ) ;
243+ await writePkg ( { scripts : { commitmsg : `${ bin } -e` } } , { cwd} ) ;
244+
245+ await execa ( 'npm' , [ 'install' ] , { cwd} ) ;
246+ await execa ( 'git' , [ 'add' , 'package.json' ] , { cwd} ) ;
247+ await execa (
248+ 'git' ,
249+ [ 'commit' , '-m' , '"test: this should work"' , '--signoff' ] ,
250+ { cwd}
251+ ) ;
252+ await execa ( 'git' , [ 'commit' , '--amend' , '--no-edit' ] , { cwd} ) ;
253+ } ) ;
254+
223255async function writePkg ( payload , options ) {
224256 const pkgPath = path . join ( options . cwd , 'package.json' ) ;
225257 const pkg = JSON . parse ( await sander . readFile ( pkgPath ) ) ;
0 commit comments