From 5b2276666f10e1ca83406927d479a1a7dc33f0eb Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" <219766164+opencode-agent[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2026 18:31:47 -0500 Subject: [PATCH] test(tui): stop Windows image preview test crashes (#46479) Co-authored-by: rekram1-node --- packages/tui/test/mini/footer.view.test.tsx | 4 +++- .../tui/test/prompt/local-attachment.test.ts | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/tui/test/mini/footer.view.test.tsx b/packages/tui/test/mini/footer.view.test.tsx index 07f030f357f..4fcaacf50ff 100644 --- a/packages/tui/test/mini/footer.view.test.tsx +++ b/packages/tui/test/mini/footer.view.test.tsx @@ -239,7 +239,9 @@ async function renderFooter( } } -test.each([ +// OpenTUI image teardown crashes Bun 1.3.14's Windows test runner after the assertions pass. +// Keep the native preview coverage on Linux while the attachment behavior remains covered on both platforms below. +test.skipIf(process.platform === "win32").each([ { width: 80, height: 24, mono: false, preview: true }, { width: 24, height: 8, mono: false, preview: true }, { width: 80, height: 24, mono: true, preview: true }, diff --git a/packages/tui/test/prompt/local-attachment.test.ts b/packages/tui/test/prompt/local-attachment.test.ts index 5aedbef8267..187c714c9a6 100644 --- a/packages/tui/test/prompt/local-attachment.test.ts +++ b/packages/tui/test/prompt/local-attachment.test.ts @@ -96,7 +96,7 @@ describe("prompt local attachments", () => { await Bun.write(file, new Uint8Array([1, 2, 3])) for (const input of [file, `'${file}'`, pathToFileURL(file).href]) { - expect(await resolvePastedAttachments(input, "linux")).toEqual([ + expect(await resolvePastedAttachments(input, process.platform)).toEqual([ { type: "file", uri: "data:image/png;base64,AQID", filename: "one image.png" }, ]) } @@ -112,7 +112,7 @@ describe("prompt local attachments", () => { `'${image}' "${pdf}"`, `# dropped files\r\n${pathToFileURL(image).href}\r\n${pathToFileURL(pdf).href}`, ]) { - expect(await resolvePastedAttachments(input, "linux")).toEqual([ + expect(await resolvePastedAttachments(input, process.platform)).toEqual([ { type: "file", uri: "data:image/png;base64,AQID", filename: "one image.png" }, { type: "file", uri: "data:application/pdf;base64,BAUG", filename: "two file.pdf" }, ]) @@ -133,7 +133,7 @@ describe("prompt local attachments", () => { `${image} ${text}`, `${image} ${path.join(tmp.path, "missing.png")}`, ]) { - expect(await resolvePastedAttachments(input, "linux")).toBeUndefined() + expect(await resolvePastedAttachments(input, process.platform)).toBeUndefined() } }) @@ -143,7 +143,9 @@ describe("prompt local attachments", () => { const content = "\r\n" await Bun.write(file, content) - expect(await resolvePastedAttachments(file, "linux")).toEqual([{ type: "text", content, filename: "image.svg" }]) + expect(await resolvePastedAttachments(file, process.platform)).toEqual([ + { type: "text", content, filename: "image.svg" }, + ]) }) test("shares the byte budget across binary and SVG attachments", async () => { @@ -156,15 +158,15 @@ describe("prompt local attachments", () => { Bun.write(svg, content), ]) - expect(await resolvePastedAttachments(`${image} ${svg}`, "linux")).toMatchObject([ + expect(await resolvePastedAttachments(`${image} ${svg}`, process.platform)).toMatchObject([ { type: "file", filename: "image.png" }, { type: "text", content, filename: "image.svg" }, ]) await Bun.write(svg, content + " ") - expect(await resolvePastedAttachments(`${image} ${svg}`, "linux")).toBeUndefined() + expect(await resolvePastedAttachments(`${image} ${svg}`, process.platform)).toBeUndefined() await Bun.write(image, new Uint8Array(MAX_LOCAL_ATTACHMENT_BYTES + 1)) - expect(await resolvePastedAttachments(image, "linux")).toBeUndefined() + expect(await resolvePastedAttachments(image, process.platform)).toBeUndefined() }) test("bounds the number of resolved paths", async () => { @@ -172,7 +174,7 @@ describe("prompt local attachments", () => { const file = path.join(tmp.path, "image.png") await Bun.write(file, new Uint8Array([1])) - expect(await resolvePastedAttachments(Array(32).fill(file).join(" "), "linux")).toHaveLength(32) - expect(await resolvePastedAttachments(Array(33).fill(file).join(" "), "linux")).toBeUndefined() + expect(await resolvePastedAttachments(Array(32).fill(file).join(" "), process.platform)).toHaveLength(32) + expect(await resolvePastedAttachments(Array(33).fill(file).join(" "), process.platform)).toBeUndefined() }) })