diff --git a/@commitlint/cli/src/cli.test.ts b/@commitlint/cli/src/cli.test.ts index a26d09cf392..6d8e32c8450 100644 --- a/@commitlint/cli/src/cli.test.ts +++ b/@commitlint/cli/src/cli.test.ts @@ -44,6 +44,20 @@ test('should produce success output with --verbose flag', async () => { expect(actual.stderr).toEqual(''); }); +test('should produce last commit and success output with --verbose flag', async () => { + const cwd = await gitBootstrap('fixtures/simple'); + await execa('git', ['add', 'commitlint.config.js'], {cwd}); + const commit = await execa( + 'git', + ['commit', '-m', '"test: this should work"'], + {cwd} + ); + const actual = await cli(['--last', '--verbose'], {cwd})(); + expect(actual.stdout).toContain('0 problems, 0 warnings'); + expect(actual.stdout).toContain('test: this should work'); + expect(actual.stderr).toEqual(''); +}); + test('should produce no output with --quiet flag', async () => { const cwd = await gitBootstrap('fixtures/default'); const actual = await cli(['--quiet'], {cwd})('foo: bar');