File tree 2 files changed +21
-3
lines changed
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 () => {
5
5
await expect ( error ) . rejects . toThrow ( 'Expected a raw commit' ) ;
6
6
} ) ;
7
7
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
+ } ) ;
11
14
} ) ;
12
15
13
16
test ( '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(
35
35
36
36
// Parse the commit message
37
37
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
+
38
53
const allRules : Map < string , Rule < unknown > | Rule < never > > = new Map (
39
54
Object . entries ( defaultRules )
40
55
) ;
You can’t perform that action at this time.
0 commit comments