Skip to content

Commit 23fd590

Browse files
committed
fix(opencode): normalize CLI test line endings
1 parent 49d3f86 commit 23fd590

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

packages/opencode/test/lib/cli-process.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ export function withCliFixture<A, E>(
237237
)
238238
return {
239239
exitCode: result.exitCode,
240-
stdout: result.stdout.toString(),
241-
stderr: result.stderr.toString(),
240+
stdout: normalizeLines(result.stdout.toString()),
241+
stderr: normalizeLines(result.stderr.toString()),
242242
durationMs: Date.now() - start,
243243
}
244244
})
@@ -299,8 +299,8 @@ export function withCliFixture<A, E>(
299299
interrupt: () => proc.kill("SIGINT"),
300300
result: Effect.promise(async () => ({
301301
exitCode: await proc.exited,
302-
stdout: await stdout,
303-
stderr: await stderr,
302+
stdout: normalizeLines(await stdout),
303+
stderr: normalizeLines(await stderr),
304304
durationMs: Date.now() - start,
305305
})),
306306
} satisfies RunHandle
@@ -479,6 +479,10 @@ function parseJsonEvents(stdout: string): Array<Record<string, unknown>> {
479479
.map((line) => JSON.parse(line) as Record<string, unknown>)
480480
}
481481

482+
function normalizeLines(value: string) {
483+
return value.replaceAll("\r\n", "\n")
484+
}
485+
482486
// Convenience for the common assertion pattern. Dumps stderr/stdout when
483487
// the exit code doesn't match — saves debugging time on CI failures.
484488
function expectExit(result: RunResult, expected: number, label = "opencode") {

0 commit comments

Comments
 (0)