fix(cli): make clean source checkouts start reliably
This commit is contained in:
@@ -61,4 +61,33 @@ describe("executable dispatcher", () => {
|
||||
args: ["--mcp", "extra"],
|
||||
});
|
||||
});
|
||||
|
||||
it("explains how to restore a missing compiled runtime", async () => {
|
||||
fixtureRoot = await mkdtemp(join(tmpdir(), "rea-dispatcher-"));
|
||||
const scripts = join(fixtureRoot, "scripts");
|
||||
await mkdir(scripts);
|
||||
await Promise.all([
|
||||
copyFile("scripts/rea.mjs", join(scripts, "rea.mjs")),
|
||||
writeFile(
|
||||
join(fixtureRoot, "package.json"),
|
||||
JSON.stringify({ type: "module", version: "1.0.0" }),
|
||||
),
|
||||
]);
|
||||
|
||||
for (const args of [["mcp"], ["--help"]]) {
|
||||
const execution = execFileAsync(process.execPath, [
|
||||
join(scripts, "rea.mjs"),
|
||||
...args,
|
||||
]);
|
||||
await expect(execution).rejects.toMatchObject({
|
||||
code: 1,
|
||||
stderr: expect.stringContaining(
|
||||
"REA's compiled runtime is missing. Run `npm ci` in",
|
||||
),
|
||||
});
|
||||
await expect(execution).rejects.toMatchObject({
|
||||
stderr: expect.not.stringContaining("ERR_MODULE_NOT_FOUND"),
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+12
-1
@@ -8,7 +8,15 @@ import { PRODUCT_IDENTITY } from "../src/identity.js";
|
||||
describe("package identity", () => {
|
||||
it("keeps the manifest, executable, and floating MCP command aligned", async () => {
|
||||
const packageJson = z
|
||||
.object({ name: z.string(), bin: z.record(z.string(), z.string()) })
|
||||
.object({
|
||||
name: z.string(),
|
||||
bin: z.record(z.string(), z.string()),
|
||||
scripts: z.object({
|
||||
start: z.string(),
|
||||
prepare: z.string(),
|
||||
prepack: z.string().optional(),
|
||||
}),
|
||||
})
|
||||
.parse(
|
||||
JSON.parse(
|
||||
await readFile(
|
||||
@@ -20,5 +28,8 @@ describe("package identity", () => {
|
||||
expect(packageJson.name).toBe(PRODUCT_IDENTITY.packageName);
|
||||
expect(Object.keys(packageJson.bin)).toEqual([PRODUCT_IDENTITY.cliBinary]);
|
||||
expect(PRODUCT_IDENTITY.mcpCommand).toBe(`npx -y ${packageJson.name} mcp`);
|
||||
expect(packageJson.scripts.start).toBe("node scripts/rea.mjs mcp");
|
||||
expect(packageJson.scripts.prepare).toBe("npm run build && husky");
|
||||
expect(packageJson.scripts.prepack).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user