fix(opencode): normalize CLI test line endings
This commit is contained in:
parent
49d3f86802
commit
23fd5907be
1 changed files with 8 additions and 4 deletions
|
|
@ -237,8 +237,8 @@ export function withCliFixture<A, E>(
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
exitCode: result.exitCode,
|
exitCode: result.exitCode,
|
||||||
stdout: result.stdout.toString(),
|
stdout: normalizeLines(result.stdout.toString()),
|
||||||
stderr: result.stderr.toString(),
|
stderr: normalizeLines(result.stderr.toString()),
|
||||||
durationMs: Date.now() - start,
|
durationMs: Date.now() - start,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -299,8 +299,8 @@ export function withCliFixture<A, E>(
|
||||||
interrupt: () => proc.kill("SIGINT"),
|
interrupt: () => proc.kill("SIGINT"),
|
||||||
result: Effect.promise(async () => ({
|
result: Effect.promise(async () => ({
|
||||||
exitCode: await proc.exited,
|
exitCode: await proc.exited,
|
||||||
stdout: await stdout,
|
stdout: normalizeLines(await stdout),
|
||||||
stderr: await stderr,
|
stderr: normalizeLines(await stderr),
|
||||||
durationMs: Date.now() - start,
|
durationMs: Date.now() - start,
|
||||||
})),
|
})),
|
||||||
} satisfies RunHandle
|
} satisfies RunHandle
|
||||||
|
|
@ -479,6 +479,10 @@ function parseJsonEvents(stdout: string): Array<Record<string, unknown>> {
|
||||||
.map((line) => JSON.parse(line) as Record<string, unknown>)
|
.map((line) => JSON.parse(line) as Record<string, unknown>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeLines(value: string) {
|
||||||
|
return value.replaceAll("\r\n", "\n")
|
||||||
|
}
|
||||||
|
|
||||||
// Convenience for the common assertion pattern. Dumps stderr/stdout when
|
// Convenience for the common assertion pattern. Dumps stderr/stdout when
|
||||||
// the exit code doesn't match — saves debugging time on CI failures.
|
// the exit code doesn't match — saves debugging time on CI failures.
|
||||||
function expectExit(result: RunResult, expected: number, label = "opencode") {
|
function expectExit(result: RunResult, expected: number, label = "opencode") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue