Skip to content

Commit

Permalink
test(cli): add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mersho committed Mar 12, 2024
1 parent 8d7a3d5 commit 657f5c4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions @commitlint/cli/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ 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});
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');

Check failure on line 60 in @commitlint/cli/src/cli.test.ts

View workflow job for this annotation

GitHub Actions / NodeJS installed from stock Ubuntu-LTS packages (not external sources)

@commitlint/cli/src/cli.test.ts > should produce last commit and success output with --verbose flag

AssertionError: expected '' to include '0 problems, 0 warnings' ❯ @commitlint/cli/src/cli.test.ts:60:24

Check failure on line 60 in @commitlint/cli/src/cli.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 18)

@commitlint/cli/src/cli.test.ts > should produce last commit and success output with --verbose flag

AssertionError: expected '' to include '0 problems, 0 warnings' ❯ @commitlint/cli/src/cli.test.ts:60:24

Check failure on line 60 in @commitlint/cli/src/cli.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04, 20)

@commitlint/cli/src/cli.test.ts > should produce last commit and success output with --verbose flag

AssertionError: expected '' to include '0 problems, 0 warnings' ❯ @commitlint/cli/src/cli.test.ts:60:24
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');
Expand Down

0 comments on commit 657f5c4

Please sign in to comment.