Skip to content

Commit 074f9b3

Browse files
committed
test: add test for format assertion
1 parent 3d71cd3 commit 074f9b3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

@commitlint/cli/src/cli.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ test('should produce no error output with -q flag', async t => {
8282
t.is(actual.code, 1);
8383
});
8484

85+
test('should throw for unknown --format', async t => {
86+
const cwd = await git.bootstrap('fixtures/empty');
87+
const actual = await cli(['--format=foo'], {cwd})('foo: bar');
88+
t.is(actual.code, 1);
89+
t.true(
90+
actual.stdout.includes(
91+
'--format must be on of: [commitlint,json], received "foo"'
92+
)
93+
);
94+
});
95+
8596
test('should produce json output with --format=json', async t => {
8697
const cwd = await git.bootstrap('fixtures/empty');
8798
const actual = await cli(['--format=json'], {cwd})('foo: bar');

0 commit comments

Comments
 (0)