/** * Agentic QE v3 - Real Test Runner Implementations * ADR-032: Time Crystal Scheduling * * Provides real test execution via Vitest and Jest subprocess calls. * Parses actual JSON test output - NO Math.random() fake results. * * IMPORTANT: These runners execute REAL tests and return REAL results. * For development/testing without real test execution, use createMockTestRunner() * from phase-executor.ts which is clearly marked as mock mode. */ import { TestRunner, TestRunnerOptions, TestRunnerResult } from './phase-executor'; /** * Error thrown when test execution fails */ export declare class TestExecutionError extends Error { readonly exitCode: number | null; readonly stderr: string; readonly command: string; constructor(message: string, exitCode: number | null, stderr: string, command: string); } /** * Error thrown when test output cannot be parsed */ export declare class TestOutputParseError extends Error { readonly rawOutput: string; readonly framework: string; constructor(message: string, rawOutput: string, framework: string); } /** * Configuration for subprocess test runners */ export interface SubprocessTestRunnerConfig { /** Working directory for test execution */ cwd: string; /** Path to node_modules/.bin or custom binary location */ binPath?: string; /** Additional environment variables */ env?: Record; /** Path to write JSON output (default: temp file) */ jsonOutputPath?: string; /** Whether to collect coverage data */ collectCoverage?: boolean; /** Coverage output directory */ coverageDir?: string; /** Test file patterns to match */ testMatch?: string[]; /** Files/patterns to exclude */ testExclude?: string[]; } /** * Base class for subprocess-based test runners */ declare abstract class SubprocessTestRunner implements TestRunner { protected readonly config: SubprocessTestRunnerConfig; constructor(config: SubprocessTestRunnerConfig); /** * Run tests for specified types */ abstract run(testTypes: string[], options: TestRunnerOptions): Promise; /** * Execute a command and capture output */ protected executeCommand(command: string, args: string[], timeout: number): Promise<{ stdout: string; stderr: string; exitCode: number | null; }>; /** * Get test file patterns for given test types */ protected getTestPatterns(testTypes: string[]): string[]; /** * Read coverage summary from coverage-summary.json */ protected readCoverageSummary(): number; } /** * Vitest Test Runner * * Executes tests using Vitest and parses JSON reporter output. * Returns REAL test results - no fake data. */ export declare class VitestTestRunner extends SubprocessTestRunner { /** * Run tests using Vitest */ run(testTypes: string[], options: TestRunnerOptions): Promise; /** * Parse Vitest JSON output into TestRunnerResult */ private parseVitestOutput; /** * Map Vitest status to our status type */ private mapVitestStatus; } /** * Jest Test Runner * * Executes tests using Jest and parses JSON output. * Returns REAL test results - no fake data. */ export declare class JestTestRunner extends SubprocessTestRunner { /** * Run tests using Jest */ run(testTypes: string[], options: TestRunnerOptions): Promise; /** * Parse Jest JSON output into TestRunnerResult */ private parseJestOutput; /** * Map Jest status to our status type */ private mapJestStatus; } /** * Auto-detect which test runner is available in the project */ export declare function detectTestRunner(cwd: string): 'vitest' | 'jest' | null; /** * Create a test runner based on auto-detection or explicit framework choice * * @param config - Subprocess test runner configuration * @param framework - Optional: force a specific framework ('vitest' | 'jest') * @returns A configured TestRunner instance * @throws Error if no test runner can be detected */ export declare function createTestRunner(config: SubprocessTestRunnerConfig, framework?: 'vitest' | 'jest'): TestRunner; /** * Convenience function to run tests with auto-detected framework * * @param cwd - Working directory containing tests * @param testTypes - Types of tests to run * @param options - Test runner options (optional, uses defaults) * @returns Test execution results */ export declare function runTests(cwd: string, testTypes: string[], options?: Partial): Promise; export {}; //# sourceMappingURL=test-runner.d.ts.map