Skip to content

API

Typed helper for suitener.config.ts.

import { defineConfig } from "suitener-core";
export default defineConfig({
target: "./src"
});

Loads and resolves suitener.config.ts from a root directory.

const config = await loadConfig(process.cwd());

Returns:

interface ResolvedSuitenerConfig {
root: string;
target: string;
include: string[];
exclude: string[];
}

Scans a target project and returns a ProjectIntrospection object.

const project = await introspect("./path/to/backend");

Runs the detected test command for an introspected project.

const project = await introspect("./path/to/backend");
const result = await runTests(project);

If no test command or no test files exist, runTests delegates to generateStubs(project).

Writes minimal Bun test stubs and returns a generated-mode result.

const project = await introspect("./path/to/backend");
const result = await generateStubs(project);

Writes a run file and latest.json.

await writeResults(project, result);

Runs a Suitener check, then launches a child command.

const handle = await wrap("bun run dev", {
cwd: process.cwd(),
onTestComplete(result) {
console.log(result.summary);
}
});
const exitCode = await handle.exited;

Return shape:

interface WrapHandle {
child: Bun.Subprocess;
testRun: Promise<SuitenerResult>;
exited: Promise<number>;
}