diff --git a/tests/conformance/releaseConfiguration.test.ts b/tests/conformance/releaseConfiguration.test.ts index 3d4f29ab2..5d72c4114 100644 --- a/tests/conformance/releaseConfiguration.test.ts +++ b/tests/conformance/releaseConfiguration.test.ts @@ -8,7 +8,14 @@ import { MCP_STARTUP_POLICY } from "../../src/mcpStartupPolicy.js"; const readJson = async (path: string): Promise => JSON.parse(await readFile(path, "utf8")) as unknown; -const versionedDocumentation = ["docs/installation.md"] as const; +// Each file lists a fragment of every example Release Please must keep +// current, so a lost marker is caught as well as a stale version. +const versionedDocumentation = [ + { + path: "docs/installation.md", + examples: ["doctor --provider ghidra --json", '"command": "npx"'], + }, +] as const; const pluginManifests = [ ".claude-plugin/plugin.json", ".codex-plugin/plugin.json", @@ -29,7 +36,7 @@ describe("release configuration", () => { packages: { ".": { "extra-files": [ - ...versionedDocumentation.map((path) => ({ + ...versionedDocumentation.map(({ path }) => ({ type: "generic", path, })), @@ -61,8 +68,8 @@ describe("release configuration", () => { }); it.each(versionedDocumentation)( - "marks the versioned package example in %s", - async (path) => { + "marks every versioned package example in $path", + async ({ path, examples }) => { const content = await readFile(path, "utf8"); const packageJson = (await readJson("package.json")) as { version: string; @@ -71,11 +78,17 @@ describe("release configuration", () => { ...content.matchAll( /[\s\S]*?/gu, ), - ]; - // Both the plugin and registry examples must remain release-owned. - expect(versionBlocks).toHaveLength(2); - for (const [block] of versionBlocks) - expect(block).toContain(`rea-agents@${packageJson.version}`); + ].map(([block]) => block); + + for (const example of examples) + expect( + versionBlocks.filter((block) => block.includes(example)), + example, + ).toHaveLength(1); + for (const block of versionBlocks) + expect(block.match(/rea-agents@[^\s"`]+/gu)).toEqual([ + `rea-agents@${packageJson.version}`, + ]); }, );