* refactor(test): colocate pure-domain tests and reduce test debt Move focused immutable domain/contracts/adapter tests from tests/composition/** beside their production owners under src/** as colocated *.test.ts/*.fixture.ts, and relocate persistence-shaped composition tests under tests/boundary/filesystem/**. Update import paths, the Vitest project topology (shared worker context for pure domain/contracts and recording-port service projects), the test migration ledger, testing docs, and AGENTS.md to match. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * docs: remove test migration ledger The cutover is complete and the ledger is no longer referenced anywhere in source, scripts, or the docs gate. Drop the standalone artifact. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * docs: clean up stale migration artifacts Remove empty directories left by the test migration and replace the "final cutover" language in docs/testing.md with standing PR guidance that no longer references the completed migration. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: repair CI failures from schema, knip, and stale generated artifacts Three root causes fixed: 1. catalog-schemas.mjs: valuesAt only traversed anyOf from Zod's toJSONSchema, not oneOf. The webScreenshotDiffSchema change to a discriminated union produces oneOf, so the product catalog generator could not derive the web_screenshot_diff schema version. Add oneOf traversal. 2. conformancePackage.ts: the test rewrite removed the only imports of ScenarioManifest, ReplayPlan, ShimPlan, and ExpectedEvidence, making them unused exports that knip flags. Remove the dead type aliases. 3. Regenerate stale artifacts (product catalog, MCP tool catalog, skill metadata, conformance manifest) that drifted from the source changes. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
96 lines
3.3 KiB
TypeScript
96 lines
3.3 KiB
TypeScript
import { copyFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
import { describe, expect } from "vitest";
|
|
|
|
import { workspaceCliTest } from "../../support/cli/workspaceCliFixture.js";
|
|
|
|
describe("executable dispatcher", () => {
|
|
workspaceCliTest(
|
|
"reserves production MCP routing for bare mode arguments",
|
|
async ({ processes, workspace }) => {
|
|
const scripts = await workspace.mkdir("scripts");
|
|
await workspace.mkdir("dist");
|
|
await Promise.all([
|
|
copyFile("scripts/rea.mjs", join(scripts, "rea.mjs")),
|
|
workspace.write(
|
|
"package.json",
|
|
JSON.stringify({ type: "module", version: "1.0.0" }),
|
|
),
|
|
workspace.write(
|
|
"dist/main.js",
|
|
'export const runEntrypoint = () => process.stdout.write(JSON.stringify({ adapter: "mcp" }));\n',
|
|
),
|
|
workspace.write(
|
|
"dist/cli.js",
|
|
'export const createCli = () => ({ serve: (args) => process.stdout.write(JSON.stringify({ adapter: "cli", args })) });\n',
|
|
),
|
|
workspace.write(
|
|
"dist/cliOutput.js",
|
|
"export const sanitizeCliOutput = (output) => output; export const validateCliOutputArguments = () => ({ ok: true }); export const renderCliOutputArgumentError = () => '';\n",
|
|
),
|
|
workspace.write(
|
|
"dist/mcpDoctor.js",
|
|
'export const runProductionMcpDoctorCli = (args) => Promise.resolve({ output: JSON.stringify({ adapter: "mcp-doctor", args }), exitCode: 0 });\n',
|
|
),
|
|
]);
|
|
|
|
const invoke = async (args: readonly string[]): Promise<unknown> => {
|
|
const { exitCode, stdout } = await processes.run(
|
|
process.execPath,
|
|
[join(scripts, "rea.mjs"), ...args],
|
|
{ cwd: workspace.root },
|
|
);
|
|
expect(exitCode).toBe(0);
|
|
return JSON.parse(stdout) as unknown;
|
|
};
|
|
|
|
await expect(invoke(["mcp"])).resolves.toEqual({ adapter: "mcp" });
|
|
await expect(invoke(["--mcp"])).resolves.toEqual({ adapter: "mcp" });
|
|
await expect(invoke(["mcp", "doctor", "--json"])).resolves.toEqual({
|
|
adapter: "mcp-doctor",
|
|
args: ["--json"],
|
|
});
|
|
await expect(invoke(["mcp", "add"])).resolves.toEqual({
|
|
adapter: "cli",
|
|
args: ["mcp", "add"],
|
|
});
|
|
await expect(invoke(["--mcp", "extra"])).resolves.toEqual({
|
|
adapter: "cli",
|
|
args: ["--mcp", "extra"],
|
|
});
|
|
},
|
|
);
|
|
|
|
workspaceCliTest(
|
|
"explains how to restore a missing compiled runtime",
|
|
async ({ processes, workspace }) => {
|
|
const scripts = await workspace.mkdir("scripts");
|
|
await Promise.all([
|
|
copyFile("scripts/rea.mjs", join(scripts, "rea.mjs")),
|
|
workspace.write(
|
|
"package.json",
|
|
JSON.stringify({ type: "module", version: "1.0.0" }),
|
|
),
|
|
]);
|
|
|
|
for (const args of [["mcp"], ["mcp", "doctor"], ["--help"]]) {
|
|
const result = await processes.run(
|
|
process.execPath,
|
|
[join(scripts, "rea.mjs"), ...args],
|
|
{ cwd: workspace.root },
|
|
);
|
|
expect(result).toMatchObject({
|
|
exitCode: 1,
|
|
stderr: expect.stringContaining(
|
|
"REA's compiled runtime is missing. Run `npm ci` in",
|
|
),
|
|
});
|
|
expect(result).toMatchObject({
|
|
stderr: expect.not.stringContaining("ERR_MODULE_NOT_FOUND"),
|
|
});
|
|
}
|
|
},
|
|
);
|
|
});
|