Standardize semantic CLI error handling

This commit is contained in:
gitea committed 2026-09-11 00:28:09 +08:00
1 parent 0b10a70924
commit 7bf40dd726
12 files changed
+153 -21

No files matched your search

+9 -1
View File
@@ -17,7 +17,15 @@ describe("CLI runner", () => {
const result = await runCli(["not-a-command"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(1);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Unknown command: not-a-command");
});
test("returns a semantic usage exit code for invalid JSON", async () => {
const result = await runCli(["version", "--json", "not-json"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Invalid JSON:");
});
});