File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,12 @@ test('throws without params', async () => {
55 await expect ( error ) . rejects . toThrow ( 'Expected a raw commit' ) ;
66} ) ;
77
8- test ( 'throws with empty message' , async ( ) => {
9- const error = ( lint as any ) ( '' ) ;
10- await expect ( error ) . rejects . toThrow ( 'Expected a raw commit' ) ;
8+ test ( 'positive on empty message' , async ( ) => {
9+ expect ( await lint ( '' ) ) . toMatchObject ( {
10+ valid : true ,
11+ errors : [ ] ,
12+ warnings : [ ]
13+ } ) ;
1114} ) ;
1215
1316test ( 'positive on stub message and no rule' , async ( ) => {
Original file line number Diff line number Diff line change @@ -35,6 +35,21 @@ export default async function lint(
3535
3636 // Parse the commit message
3737 const parsed = await parse ( message , undefined , opts . parserOpts ) ;
38+
39+ if (
40+ parsed . header === null &&
41+ parsed . body === null &&
42+ parsed . footer === null
43+ ) {
44+ // Commit is empty, skip
45+ return {
46+ valid : true ,
47+ errors : [ ] ,
48+ warnings : [ ] ,
49+ input : message
50+ } ;
51+ }
52+
3853 const allRules : Map < string , Rule < unknown > | Rule < never > > = new Map (
3954 Object . entries ( defaultRules )
4055 ) ;
You can’t perform that action at this time.
0 commit comments