fix(cli): reject an empty JavaScript application path (#5265)

This commit is contained in:
Vishal Tambi authored and GitHub committed 2026-10-22 03:50:52 +08:00
1 parent d8199ab6af
commit 1a945ce9ff
2 files changed
+28 -1

No files matched your search

@@ -140,3 +140,28 @@ cliTest(
).toBe(true);
},
);
// Anchoring must not turn an empty selection into the working directory.
cliTest.for([
{
command: "analyze-javascript-application",
rejection: {
code: "invalid_request",
details: { issues: [expect.objectContaining({ path: ["input_path"] })] },
},
},
{ command: "analyze", rejection: { code: "VALIDATION_ERROR" } },
])(
"$command rejects an empty path instead of analyzing the working directory",
async ({ command, rejection }, { cli }) => {
const root = await createTestTempDirectory("rea-js-empty-path-");
await writeFile(join(root, "main.js"), "export const value = 7;\n");
const response = await cli.run({
arguments: [command, "", "--json"],
cwd: root,
environment: { REA_LOG_LEVEL: "silent" },
});
expect(response.exitCode, response.stderr).toBe(1);
expect(response.json).toMatchObject(rejection);
},
);