From 23fd5907be901c0b6727e7646823d4168d43389f Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 22 Jun 2026 19:15:26 -0400 Subject: [PATCH] fix(opencode): normalize CLI test line endings --- packages/opencode/test/lib/cli-process.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/opencode/test/lib/cli-process.ts b/packages/opencode/test/lib/cli-process.ts index 9c34e336b..6b16ab74b 100644 --- a/packages/opencode/test/lib/cli-process.ts +++ b/packages/opencode/test/lib/cli-process.ts @@ -237,8 +237,8 @@ export function withCliFixture( ) return { exitCode: result.exitCode, - stdout: result.stdout.toString(), - stderr: result.stderr.toString(), + stdout: normalizeLines(result.stdout.toString()), + stderr: normalizeLines(result.stderr.toString()), durationMs: Date.now() - start, } }) @@ -299,8 +299,8 @@ export function withCliFixture( interrupt: () => proc.kill("SIGINT"), result: Effect.promise(async () => ({ exitCode: await proc.exited, - stdout: await stdout, - stderr: await stderr, + stdout: normalizeLines(await stdout), + stderr: normalizeLines(await stderr), durationMs: Date.now() - start, })), } satisfies RunHandle @@ -479,6 +479,10 @@ function parseJsonEvents(stdout: string): Array> { .map((line) => JSON.parse(line) as Record) } +function normalizeLines(value: string) { + return value.replaceAll("\r\n", "\n") +} + // Convenience for the common assertion pattern. Dumps stderr/stdout when // the exit code doesn't match — saves debugging time on CI failures. function expectExit(result: RunResult, expected: number, label = "opencode") {