Files
opencommit/test/e2e/smoke.test.ts
di-sukharev 88964cbc5e test(cli): overhaul e2e coverage and CI
Split smoke, core, and prompt-module suites and make test:e2e self-contained with an explicit build step and version-check bypass.

Move core CLI coverage to a process-based harness with mock OpenAI boundary checks, add user-path scenarios, refresh CI jobs, and commit the rebuilt out/cli.cjs artifact.
2026-04-10 15:16:32 +03:00

27 lines
1.0 KiB
TypeScript

import packageJson from '../../package.json';
import 'cli-testing-library/extend-expect';
import { runCli, waitForExit } from './utils';
it('prints help without entering the interactive flow', async () => {
const help = await runCli(['--help'], {
cwd: process.cwd()
});
expect(await help.findByText('opencommit')).toBeInTheConsole();
expect(await help.findByText('--context')).toBeInTheConsole();
expect(await help.findByText('--yes')).toBeInTheConsole();
expect(await help.queryByText('Select your AI provider:')).not.toBeInTheConsole();
expect(await help.queryByText('Enter your API key:')).not.toBeInTheConsole();
expect(await waitForExit(help)).toBe(0);
});
it('prints the current version without booting the CLI runtime', async () => {
const version = await runCli(['--version'], {
cwd: process.cwd()
});
expect(await version.findByText(packageJson.version)).toBeInTheConsole();
expect(await version.queryByText('Generating the commit message')).not.toBeInTheConsole();
expect(await waitForExit(version)).toBe(0);
});