/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Shared harness for the corpus-recipe tests. * * It lives under `test-kit/` and is excluded from corpus's build project, so it is never emitted into * `out/` and never reaches the published tarball. */ import { type TemporaryDirectory } from "@mailwoman/core/fs/temporary"; import type { PathBuilder } from "path-ts"; import type { RecipeOptions } from "#recipes/scaffold"; /** * The fields a recipe assertion reads off an emitted row. * * A declared shape lets the code check `parseJSONStrict`'s `unknown` value. */ export interface RecipeRow { raw: string; recipe?: string; register?: string | null; surface?: string; base_source_id?: string | null; source?: string; source_id?: string; components?: Partial>; labels?: string[]; tokens?: string[]; } /** * A recipe's `run` surface, as the tests drive it. */ export interface CorpusRecipe { run(options: RecipeOptions, emit: (line: string) => void): Promise; } /** * The two input paths a recipe reads, plus the directory holding them. * * The caller owns it, because a recipe opens both files by path well after this function returns. */ export type RecipeInputs = TemporaryDirectory & { input: PathBuilder; exclude: PathBuilder; }; /** * Write the tuple + reserved-surface inputs a recipe reads, into a fresh temporary directory. */ export declare function scratch(prefix: string, tuples: object[], surfaces: string[]): Promise; /** * The register id included in a harness-built tuple set. * * It names no publisher, so a row written under it cannot be mistaken for a real register's record. */ export declare const TEST_REGISTER = "test-harness"; /** * Bind a recipe and its seed to a runner the tests call with just the tuples and reserved surfaces. * * The seed is required because these suites assert on generated distributions. */ export declare function recipeRunner(prefix: string, recipe: CorpusRecipe, seed: number): (tuples: object[], surfaces: string[], opts?: Partial) => Promise<{ stats: TStats; rows: RecipeRow[]; }>; //# sourceMappingURL=corpus-recipe.d.ts.map