/** * `codebase-targeted-test` tool — automatically identify and run only the relevant tests for a modified symbol or file. * * Usage: codebase-targeted-test({ * symbol?: string, // function/class/type name that was changed * file?: string, // source file that was changed * testFiles?: string[], // explicitly specified test files (optional) * }) */ import type { Tool } from '@wrongstack/core/types'; export interface TargetedTestInput { /** Symbol name (function, class, method) whose tests should be discovered and run. */ symbol?: string | undefined; /** Source file path whose corresponding test suite should be run. */ file?: string | undefined; /** Optional explicit list of test files to run. */ testFiles?: string[] | undefined; } export type CodebaseTargetedTestInput = TargetedTestInput; export interface TargetedTestOutput { status: 'passed' | 'failed' | 'no_tests_found'; discoveredSuites: string[]; testsRun: number; passed: number; failed: number; durationMs: number; output: string; } export type CodebaseTargetedTestOutput = TargetedTestOutput; /** * Pull pass/fail counts out of a runner's (ANSI-stripped) output. * * Vitest prints `Test Files 1 passed (1)` BEFORE `Tests 5 passed (5)`; the * old first-match regex reported the suite count as the test count. Scope to * the vitest `Tests` summary line when present, otherwise take the LAST * summary (pytest prints `== 3 passed, 1 failed in 0.2s ==` at the end). * Returns null when no counts are printed (e.g. `go test`). */ export declare function parseTestCounts(output: string): { passed: number; failed: number; } | null; /** * Pick the runner for the discovered suites. * * - `go test` takes PACKAGES: handed `pkg/foo_test.go` it compiles that one * file without the package's sources and fails on every undefined symbol. * - A jest project was run with `npx vitest run`, which is not installed there. * - Suites of different runners cannot share one command line; the old * fallback handed `.py` files to vitest. */ export declare function selectTestRunner(projectRoot: string, suites: readonly string[]): Promise<{ cmd: string; args: string[]; }>; export declare const codebaseTargetedTestTool: Tool; //# sourceMappingURL=codebase-targeted-test-tool.d.ts.map