diff --git a/@commitlint/format/src/format.test.ts b/@commitlint/format/src/format.test.ts index dd88fdabaa..10b70e76aa 100644 --- a/@commitlint/format/src/format.test.ts +++ b/@commitlint/format/src/format.test.ts @@ -35,6 +35,29 @@ test('returns empty summary if verbose', () => { expect(actual).toContain('0 problems, 0 warnings'); }); +test('returns empty summary with full commit message if verbose', () => { + const actual = format( + { + results: [ + { + errors: [], + warnings: [], + input: + 'feat(cli): this is a valid header\n\nThis is a valid body\n\nSigned-off-by: tester', + }, + ], + }, + { + verbose: true, + color: false, + } + ); + + expect(actual).toStrictEqual( + '⧗ input: feat(cli): this is a valid header\n\nThis is a valid body\n\nSigned-off-by: tester\n✔ found 0 problems, 0 warnings' + ); +}); + test('returns a correct summary of empty .errors and .warnings', () => { const actualError = format({ results: [ diff --git a/@commitlint/format/src/format.ts b/@commitlint/format/src/format.ts index e3fa2dd266..13baf4bf5e 100644 --- a/@commitlint/format/src/format.ts +++ b/@commitlint/format/src/format.ts @@ -42,9 +42,8 @@ function formatInput( const sign = '⧗'; const decoration = enabled ? chalk.gray(sign) : sign; - const commitText = errors.length > 0 ? input : input.split('\n')[0]; - const decoratedInput = enabled ? chalk.bold(commitText) : commitText; + const decoratedInput = enabled ? chalk.bold(input) : input; const hasProblems = errors.length > 0 || warnings.length > 0; return options.verbose || hasProblems