@@ -71,6 +71,40 @@ describe(function() {
7171 expect ( err . exitCode ) . to . equal ( 1 ) ;
7272 } ) ;
7373
74+ it ( 'succeeds when one good commit and one unconventional commit on branch' , async function ( ) {
75+ await execa ( 'git' , [ 'branch' , 'foo' ] , { cwd : tmpPath } ) ;
76+ await execa ( 'git' , [ 'checkout' , 'foo' ] , { cwd : tmpPath } ) ;
77+ await execa ( 'git' , [ 'commit' , '--allow-empty' , '-m' , 'foo' ] , { cwd : tmpPath } ) ;
78+ await execa ( 'git' , [ 'commit' , '--allow-empty' , '-m' , 'chore: bar' ] , { cwd : tmpPath } ) ;
79+
80+ let { stdout } = await execa ( bin , { cwd : tmpPath } ) ;
81+
82+ expect ( stdout ) . to . equal ( `⧗ input: chore: bar
83+ ✔ found 0 problems, 0 warnings` ) ;
84+ } ) ;
85+
86+ it ( 'fails when lint-every-commit is enabled and branch has one good commit and one unconventional commit' , async function ( ) {
87+ await execa ( 'git' , [ 'branch' , 'foo' ] , { cwd : tmpPath } ) ;
88+ await execa ( 'git' , [ 'checkout' , 'foo' ] , { cwd : tmpPath } ) ;
89+ await execa ( 'git' , [ 'commit' , '--allow-empty' , '-m' , 'foo' ] , { cwd : tmpPath } ) ;
90+ await execa ( 'git' , [ 'commit' , '--allow-empty' , '-m' , 'chore: bar' ] , { cwd : tmpPath } ) ;
91+
92+ let err = await execa ( bin , [ '--lint-every-commit' ] , {
93+ cwd : tmpPath ,
94+ reject : false ,
95+ } ) ;
96+
97+ expect ( err . stdout . trim ( ) ) . to . equal ( `⧗ input: chore: bar
98+ ✔ found 0 problems, 0 warnings
99+ ⧗ input: foo
100+ ✖ subject may not be empty [subject-empty]
101+ ✖ type may not be empty [type-empty]
102+
103+ ✖ found 2 problems, 0 warnings` ) ;
104+
105+ expect ( err . exitCode ) . to . equal ( 1 ) ;
106+ } ) ;
107+
74108 // There is no way to actually generate just a `subject-empty` error.
75109 // `chore:` is always recognized as missing a type with a `type-empty` as well.
76110 // eslint-disable-next-line mocha/no-skipped-tests
0 commit comments