/** * Agentic QE v3 - Test Executor Service * Implements ITestExecutionService for running test suites */ import { Result } from '../../../shared/types'; import { ExecuteTestsRequest, ParallelExecutionRequest, TestRunResult, ExecutionStats } from '../interfaces'; import { MemoryBackend } from '../../../kernel/interfaces'; /** * Configuration for the test executor service */ export interface TestExecutorConfig { /** * When true, simulates test execution with random outcomes (for unit testing). * When false (default), returns deterministic results or structured errors * indicating no real test runner is available. */ simulateForTesting: boolean; /** * Base number of tests to report per file in simulation mode. * Defaults to 5. */ simulatedTestsPerFile: number; /** * Simulated failure rate (0-1) when simulateForTesting is true. * Defaults to 0.2 (20% chance of failure per file). */ simulatedFailureRate: number; /** * Simulated skip rate (0-1) when simulateForTesting is true. * Defaults to 0.1 (10% chance of skip per file). */ simulatedSkipRate: number; } export interface ITestExecutionService { /** Execute test suite */ execute(request: ExecuteTestsRequest): Promise>; /** Execute tests in parallel */ executeParallel(request: ParallelExecutionRequest): Promise>; /** Get execution results by run ID */ getResults(runId: string): Promise>; /** Get execution statistics */ getStats(runId: string): Promise>; } export declare class TestExecutorService implements ITestExecutionService { private readonly memory; private readonly runResults; private readonly runStats; private readonly config; constructor(memory: MemoryBackend, config?: Partial); /** * Execute a test suite sequentially */ execute(request: ExecuteTestsRequest): Promise>; /** * Execute tests in parallel across multiple workers */ executeParallel(request: ParallelExecutionRequest): Promise>; /** * Get results for a specific run */ getResults(runId: string): Promise>; /** * Get execution statistics for a run */ getStats(runId: string): Promise>; private validateRequest; private validateParallelRequest; private runTests; private executeTestFile; /** * Spawn actual test runner process (vitest, jest, mocha) */ private spawnTestRunner; /** * Build test command based on framework */ private buildTestCommand; /** * Parse test runner output to extract results */ private parseTestOutput; /** * Parse vitest JSON output */ private parseVitestOutput; /** * Parse jest JSON output */ private parseJestOutput; /** * Parse mocha JSON output */ private parseMochaOutput; /** * Fallback: parse test summary line from text output */ private parseTestSummaryLine; /** * Create generic failure entries when we know tests failed but can't parse details */ private createGenericFailures; /** * Simulate test execution with random outcomes (for unit testing only) */ private simulateTestExecution; private shardTests; private executeWorker; private aggregateResults; private aggregateCoverage; private storeResults; } //# sourceMappingURL=test-executor.d.ts.map