@@ -82,6 +82,37 @@ test('Test cli flags', (t) => {
82
82
} )
83
83
} )
84
84
85
+ t . test ( 'test tap output' , ( tt ) => {
86
+ // Use a commit from this repository that does not follow the guidelines.
87
+ const ls = spawn ( './bin/cmd.js' , [ '--no-validate-metadata' , '--tap' , '69435db261' ] )
88
+ let compiledData = ''
89
+ ls . stdout . on ( 'data' , ( data ) => {
90
+ compiledData += data
91
+ } )
92
+
93
+ ls . stderr . on ( 'data' , ( data ) => {
94
+ tt . fail ( `Unexpected stderr output ${ data . toString ( ) } ` )
95
+ } )
96
+
97
+ ls . on ( 'close' , ( code ) => {
98
+ const output = compiledData . trim ( )
99
+ tt . match ( output ,
100
+ / # 6 9 4 3 5 d b 2 6 1 / ,
101
+ 'TAP output contains the sha of the commit being linted' )
102
+ tt . match ( output ,
103
+ / n o t o k \d + s u b s y s t e m : I n v a l i d s u b s y s t e m : " c h o r e " \( c h o r e : u p d a t e t e s t e d n o d e r e l e a s e l i n e s \( # 9 4 \) \) / ,
104
+ 'TAP output contains failure for subsystem' )
105
+ tt . match ( output ,
106
+ / # f a i l \s + \d + / ,
107
+ 'TAP output contains total failures' )
108
+ tt . match ( output ,
109
+ / # P l e a s e r e v i e w t h e c o m m i t m e s s a g e g u i d e l i n e s : \s # h t t p s : \/ \/ g i t h u b .c o m \/ n o d e j s \/ n o d e \/ b l o b \/ H E A D \/ d o c \/ c o n t r i b u t i n g \/ p u l l - r e q u e s t s .m d # c o m m i t - m e s s a g e - g u i d e l i n e s / ,
110
+ 'TAP output contains pointer to commit message guidelines' )
111
+ tt . equal ( code , 1 , 'CLI exits with non-zero code on failure' )
112
+ tt . end ( )
113
+ } )
114
+ } )
115
+
85
116
t . test ( 'test url' , ( tt ) => {
86
117
const ls = spawn ( './bin/cmd.js' , [ '--no-validate-metadata' , 'https://api.github.com/repos/nodejs/core-validate-commit/commits/2b98d02b52' ] )
87
118
let compiledData = ''
0 commit comments