EMBED-AND-CI-04: Gate a vitest suite on findings
What it demonstrates
Section titled “What it demonstrates”Asserting on runCorpus’s findings inside a test so corpus drift fails the test run.
Builds on: EMBED-AND-CI-01: Run the corpus in-process
How it’s done
Section titled “How it’s done”A TypeScript program against the library API; inline comments show the resulting values and behavior.
import { expect, test } from "vitest";import { runCorpus } from "markdown-contract";import config from "./markdown-contract.config.js";
test("planning corpus has no error findings", () => { const { findings, exitCode } = runCorpus(config, { cwd: "docs/planning" }); expect(findings.filter((f) => f.level === "error")).toEqual([]); expect(exitCode).toBe(0);});Surfaces exercised
Section titled “Surfaces exercised”runCorpus inside a testFinding.level filteringexitCode assertion