@@ -446,6 +446,7 @@ test('should print help', async () => {
446
446
Options:
447
447
-c, --color toggle colored output [boolean] [default: true]
448
448
-g, --config path to the config file [string]
449
+ --print-config print resolved config [boolean] [default: false]
449
450
-d, --cwd directory to execute in
450
451
[string] [default: (Working Directory)]
451
452
-e, --edit read last commit message from the specified file or
@@ -475,6 +476,27 @@ test('should print version', async () => {
475
476
expect ( actual . stdout ) . toMatch ( '@commitlint/cli@' ) ;
476
477
} ) ;
477
478
479
+ test ( 'should print config' , async ( ) => {
480
+ const cwd = await gitBootstrap ( 'fixtures/default' ) ;
481
+ const actual = await cli ( [ '--print-config' , '--no-color' ] , { cwd} ) ( ) ;
482
+ const stdout = actual . stdout
483
+ . replace ( / ^ { [ ^ \n ] / g, '{\n ' )
484
+ . replace ( / [ ^ \n ] } $ / g, '\n}' )
485
+ . replace ( / ( h e l p U r l : ) \n [ ] + / , '$1 ' ) ;
486
+ expect ( stdout ) . toMatchInlineSnapshot ( `
487
+ "{
488
+ extends: [],
489
+ formatter: '@commitlint/format',
490
+ parserPreset: undefined,
491
+ ignores: undefined,
492
+ defaultIgnores: undefined,
493
+ plugins: {},
494
+ rules: { 'type-enum': [ 2, 'never', [ 'foo' ] ] },
495
+ helpUrl: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
496
+ }"
497
+ ` ) ;
498
+ } ) ;
499
+
478
500
async function writePkg ( payload : unknown , options : TestOptions ) {
479
501
const pkgPath = path . join ( options . cwd , 'package.json' ) ;
480
502
const pkg = JSON . parse ( await fs . readFile ( pkgPath , 'utf-8' ) ) ;
0 commit comments