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