test(release): check every versioned example block in the installation guide
The conformance test read only the first Release Please version block, so adding the plugin readiness block ahead of the MCP Registry example left the registry example unchecked. Check every block, and require each known example to sit inside exactly one, so a stale version or a lost marker in any of them fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
22de1ff010
commit
9d658d767a
|
|
@ -8,7 +8,14 @@ import { MCP_STARTUP_POLICY } from "../../src/mcpStartupPolicy.js";
|
|||
const readJson = async (path: string): Promise<unknown> =>
|
||||
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,18 +68,27 @@ 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;
|
||||
};
|
||||
const versionBlock =
|
||||
/<!-- x-release-please-start-version -->[\s\S]*?<!-- x-release-please-end -->/u.exec(
|
||||
content,
|
||||
)?.[0];
|
||||
const versionBlocks = [
|
||||
...content.matchAll(
|
||||
/<!-- x-release-please-start-version -->[\s\S]*?<!-- x-release-please-end -->/gu,
|
||||
),
|
||||
].map(([block]) => block);
|
||||
|
||||
expect(versionBlock).toContain(`rea-agents@${packageJson.version}`);
|
||||
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}`,
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue