UNPKG

tui-tester

Version:

End-to-end testing framework for terminal user interfaces

103 lines (97 loc) 2.81 kB
import { h as RuntimeAdapter, C as ChildProcess, g as Runtime } from '../types-I_UaGSPL.js'; /** * Base Runtime Adapter * Abstract base class for runtime-specific implementations */ declare abstract class BaseRuntimeAdapter implements RuntimeAdapter { abstract exec(command: string): Promise<{ stdout: string; stderr: string; code: number; }>; abstract spawn(command: string, args: string[]): Promise<ChildProcess>; abstract readFile(path: string): Promise<string>; abstract writeFile(path: string, content: string): Promise<void>; abstract exists(path: string): Promise<boolean>; abstract mkdir(path: string, options?: { recursive?: boolean; }): Promise<void>; /** * Cross-platform sleep implementation */ sleep(ms: number): Promise<void>; /** * Execute command with timeout */ execWithTimeout(command: string, timeoutMs?: number): Promise<{ stdout: string; stderr: string; code: number; }>; /** * Try to execute command, return null on failure */ tryExec(command: string): Promise<{ stdout: string; stderr: string; code: number; } | null>; /** * Check if command is available */ commandExists(command: string): Promise<boolean>; /** * Get environment variable */ getEnv(key: string): string | undefined; /** * Set environment variable */ setEnv(key: string, value: string): void; /** * Get current working directory */ getCwd(): string; /** * Get platform */ getPlatform(): string; /** * Check if running on Windows */ isWindows(): boolean; /** * Check if running in CI environment */ isCI(): boolean; } /** * Runtime Adapter Factory * Automatically selects the appropriate adapter based on the current runtime */ /** * Register a custom adapter */ declare function registerAdapter(name: string, adapterClass: new () => RuntimeAdapter, options?: { detect?: () => boolean; priority?: number; }): void; declare function setDefaultAdapter(name: string): void; /** * Detect the current JavaScript runtime */ declare function detectRuntime(): Runtime; /** * Create a runtime adapter for the current environment */ declare function createAdapter(runtime?: Runtime | string): RuntimeAdapter; declare function getAdapter(): RuntimeAdapter; /** * Set a custom adapter (useful for testing) */ declare function setAdapter(adapter: RuntimeAdapter): void; /** * Reset the adapter to auto-detect */ declare function resetAdapter(): void; export { BaseRuntimeAdapter, Runtime, RuntimeAdapter, createAdapter, detectRuntime, getAdapter, registerAdapter, resetAdapter, setAdapter, setDefaultAdapter };