File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 11import { QualifiedRules , RuleConfigSeverity } from '@commitlint/types' ;
2+ import { red } from 'chalk' ;
23import {
34 breakingChangeFilterFactory ,
45 breakingChangeMessageFactory ,
6+ breakingTransformFactory ,
57 issueFilterFactory ,
68 issuesMessageFactory ,
79} from './footer-maker' ;
@@ -50,4 +52,21 @@ describe('footerMaker', () => {
5052 expect ( result ) . toBe ( 'Add issue references (e.g. "fix #123", "re #123".) (max 88 chars):\n' ) ;
5153 } ) ;
5254 } ) ;
55+
56+ describe ( 'breakingTransformFactory' , ( ) => {
57+ it ( 'should show a message in red color when footer has maximum length rule' , ( ) => {
58+ const rules : QualifiedRules = { 'footer-max-length' : [ RuleConfigSeverity . Error , 'always' , 88 ] } ;
59+
60+ const fixture = breakingTransformFactory ( rules , 'BREAKING CHANGE: ' ) ;
61+
62+ const result = fixture (
63+ 'The coverage has decreased with this PR, please add tests for the additional functions to at least bring the coverage to the same percentage.'
64+ ) ;
65+ expect ( result ) . toBe (
66+ red (
67+ '(141) The coverage has decreased with this PR, please add tests for the additional functions to at least bring the coverage to the same percentage.'
68+ )
69+ ) ;
70+ } ) ;
71+ } ) ;
5372} ) ;
You can’t perform that action at this time.
0 commit comments