@@ -110,10 +110,49 @@ describe('Commit Linter action', () => {
110110
111111 await runAction ( )
112112
113+ console . log ( )
113114 td . verify ( core . setFailed ( contains ( 'wrong message 1' ) ) )
114115 td . verify ( core . setFailed ( contains ( 'wrong message 2' ) ) )
115116 } )
116117
118+ it ( 'should pass for push range with wrong messages with failOnErrors set to false' , async ( ) => {
119+ td . when ( core . getInput ( 'failOnErrors' ) ) . thenReturn ( 'false' )
120+ cwd = await git . bootstrap ( 'fixtures/conventional' )
121+ await gitEmptyCommit ( cwd , 'message from before push' )
122+ await gitEmptyCommit ( cwd , 'wrong message 1' )
123+ await gitEmptyCommit ( cwd , 'wrong message 2' )
124+ const [ before , , to ] = await getCommitHashes ( cwd )
125+ await createPushEventPayload ( cwd , { before, to } )
126+ updatePushEnvVars ( cwd , to )
127+ td . replace ( process , 'cwd' , ( ) => cwd )
128+ td . replace ( console , 'log' )
129+
130+ await runAction ( )
131+
132+ td . verify ( core . setFailed ( ) , { times : 0 , ignoreExtraArgs : true } )
133+ td . verify ( console . log ( contains ( 'Passing despite errors ✅' ) ) )
134+ td . verify ( core . setOutput ( contains ( 'wrong message 1' ) ) )
135+ td . verify ( core . setOutput ( contains ( 'wrong message 2' ) ) )
136+ } )
137+
138+ it ( 'should pass for push range with correct messages with failOnErrors set to false' , async ( ) => {
139+ td . when ( core . getInput ( 'failOnErrors' ) ) . thenReturn ( 'false' )
140+ cwd = await git . bootstrap ( 'fixtures/conventional' )
141+ await gitEmptyCommit ( cwd , 'message from before push' )
142+ await gitEmptyCommit ( cwd , 'chore: correct message 1' )
143+ await gitEmptyCommit ( cwd , 'chore: correct message 2' )
144+ const [ before , , to ] = await getCommitHashes ( cwd )
145+ await createPushEventPayload ( cwd , { before, to } )
146+ updatePushEnvVars ( cwd , to )
147+ td . replace ( process , 'cwd' , ( ) => cwd )
148+ td . replace ( console , 'log' )
149+
150+ await runAction ( )
151+
152+ td . verify ( core . setFailed ( ) , { times : 0 , ignoreExtraArgs : true } )
153+ td . verify ( console . log ( 'Lint free! 🎉' ) )
154+ } )
155+
117156 it ( 'should pass for push range with correct messages' , async ( ) => {
118157 cwd = await git . bootstrap ( 'fixtures/conventional' )
119158 await gitEmptyCommit ( cwd , 'message from before push' )
0 commit comments