@@ -482,6 +482,24 @@ test('should work with relative formatter path', async () => {
482482 expect ( actual . exitCode ) . toBe ( 0 ) ;
483483} ) ;
484484
485+ test ( 'strict: should exit with 3 on error' , async ( ) => {
486+ const cwd = await gitBootstrap ( 'fixtures/warning' ) ;
487+ const actual = await cli ( [ '--strict' ] , { cwd} ) ( 'foo: abcdef' ) ;
488+ expect ( actual . exitCode ) . toBe ( 3 ) ;
489+ } ) ;
490+
491+ test ( 'strict: should exit with 2 on warning' , async ( ) => {
492+ const cwd = await gitBootstrap ( 'fixtures/warning' ) ;
493+ const actual = await cli ( [ '--strict' ] , { cwd} ) ( 'feat: abcdef' ) ;
494+ expect ( actual . exitCode ) . toBe ( 2 ) ;
495+ } ) ;
496+
497+ test ( 'strict: should exit with 0 on success' , async ( ) => {
498+ const cwd = await gitBootstrap ( 'fixtures/warning' ) ;
499+ const actual = await cli ( [ '--strict' ] , { cwd} ) ( 'feat: abc' ) ;
500+ expect ( actual . exitCode ) . toBe ( 0 ) ;
501+ } ) ;
502+
485503test ( 'should print help' , async ( ) => {
486504 const cwd = await gitBootstrap ( 'fixtures/default' ) ;
487505 const actual = await cli ( [ '--help' ] , { cwd} ) ( ) ;
@@ -507,7 +525,7 @@ test('should print help', async () => {
507525 -f, --from lower end of the commit range to lint; applies if
508526 edit=false [string]
509527 --git-log-args addditional git log arguments as space separated string,
510- example \ '--first-parent --cherry-pick\ ' [string]
528+ example '--first-parent --cherry-pick' [string]
511529 -o, --format output format of the results [string]
512530 -p, --parser-preset configuration preset to use for
513531 conventional-commits-parser [string]
@@ -516,6 +534,8 @@ test('should print help', async () => {
516534 edit=false [string]
517535 -V, --verbose enable verbose output for reports without problems
518536 [boolean]
537+ -s, --strict enable strict mode; result code 2 for warnings, 3 for
538+ errors [boolean]
519539 -v, --version display version information [boolean]
520540 -h, --help Show help [boolean]"
521541 ` ) ;
0 commit comments