/** * Headless runner for TUI applications. * Runs apps without terminal output, with buffer capture and keypress injection. * Useful for testing, automation, and programmatic control. */ import { CellBuffer } from "./buffer.js"; import { ConsoleCapture } from "./console-capture.js"; import type { VNode } from "./vnode.js"; export interface HeadlessRunnerOptions { /** Terminal width (default: 80) */ width?: number; /** Terminal height (default: 24) */ height?: number; /** Enable console capture (default: true) */ captureConsole?: boolean; } export interface HeadlessRunner { /** Get the current screen as a string (all rows joined by newlines) */ getScreen(): string; /** Get a specific row from the screen */ getRow(y: number): string; /** Get the raw cell buffer for detailed assertions */ getBuffer(): CellBuffer; /** Simulate a keypress */ pressKey(key: string): void; /** Simulate typing a string (sends each character) */ type(text: string): void; /** Check if the screen contains a string */ hasText(text: string): boolean; /** Get the console capture instance (if enabled) */ getConsoleCapture(): ConsoleCapture | null; /** Check if console log panel is visible */ isLogPanelVisible(): boolean; /** Get the current focused element (for debugging) */ getFocusedElement(): string; /** Dispose the headless runner and clean up */ dispose(): void; } /** * Create a headless runner for a TUI application. * * @example * ```ts * import { createHeadlessRunner, KEYS } from 'treeli'; * * function App() { * return Hello World; * } * * const runner = createHeadlessRunner(App); * expect(runner.hasText("Hello World")).toBe(true); * * runner.pressKey(KEYS.CTRL_L); * expect(runner.isLogPanelVisible()).toBe(true); * * runner.dispose(); * ``` */ export declare function createHeadlessRunner(App: () => VNode, options?: HeadlessRunnerOptions): HeadlessRunner; //# sourceMappingURL=headless-runner.d.ts.map