From dd46fddf22c17d5177a3a4efa17ca720d4b6327d Mon Sep 17 00:00:00 2001 From: Shoubhit Dash Date: Wed, 13 May 2026 11:10:12 +0530 Subject: [PATCH] test(cli): cover config json diagnostics (#27257) --- packages/opencode/test/cli/error.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/opencode/test/cli/error.test.ts b/packages/opencode/test/cli/error.test.ts index e9ede9cdb7..09119a4ff6 100644 --- a/packages/opencode/test/cli/error.test.ts +++ b/packages/opencode/test/cli/error.test.ts @@ -39,6 +39,17 @@ describe("cli.error", () => { } }) + test("preserves multiline JSONC diagnostics for tagged config errors", () => { + const data = { + path: "/tmp/opencode.jsonc", + message: '\n--- JSONC Input ---\n{\n "model": \n}\n--- Errors ---\nValueExpected at line 3, column 1\n Line 3: }\n ^\n--- End ---', + } + const expected = `Config file at ${data.path} is not valid JSON(C): ${data.message}` + + expect(FormatError({ name: "ConfigJsonError", data })).toBe(expected) + expect(FormatError({ _tag: "ConfigJsonError", ...data })).toBe(expected) + }) + test("formats account transport errors clearly", () => { const error = new AccountTransportError({ method: "POST",