refactor: fix windows test

This commit is contained in:
Catriel Müller
2026-06-19 11:47:20 -03:00
parent 02bbf661b0
commit 3babed6a5b
@@ -8,9 +8,11 @@ import { Effect } from "effect"
import { cliIt } from "../../lib/cli-process"
describe("opencode run (non-interactive subprocess)", () => {
// Keep full CLI subprocesses serial within this file; the test runner already
// executes files in parallel, and nested concurrency exhausts Windows CI.
// Happy path: prompt completes, output reaches stdout, process exits 0.
// If this fails, all the others likely will too — debug here first.
cliIt.concurrent(
cliIt.live(
"exits 0 and writes the response to stdout on a successful prompt",
({ llm, opencode }) =>
Effect.gen(function* () {
@@ -24,21 +26,20 @@ describe("opencode run (non-interactive subprocess)", () => {
// Regression for #27371: an unknown model used to hang the process forever
// waiting on a session.status === idle event that never arrived. The fix
// makes the SDK call surface an error promptly so the process exits nonzero.
// We assert nonzero exit AND wall-clock under the harness timeout — a hang
// would expire the timeout and produce a different (signal-killed) failure.
cliIt.concurrent(
// makes the SDK call surface an error promptly so the process exits 1.
// A harness timeout produces synthetic exit code -1, so the exact assertion
// distinguishes the intended failure from a signal-killed process.
cliIt.live(
"exits nonzero promptly when the model is unknown (regression for #27371)",
({ opencode }) =>
Effect.gen(function* () {
const result = yield* opencode.run("say hi", {
model: "test/nonexistent-model",
timeoutMs: 15_000,
timeoutMs: 30_000,
})
expect(result.exitCode).not.toBe(0)
expect(result.durationMs).toBeLessThan(15_000)
opencode.expectExit(result, 1)
}),
30_000,
60_000,
)
// Locks in the current behavior: when the LLM stream errors mid-response
@@ -47,7 +48,7 @@ describe("opencode run (non-interactive subprocess)", () => {
//
// This is debatable — a future cleanup might flip it to exit 1. If you're
// changing this expectation, do it deliberately and say so in the PR.
cliIt.concurrent(
cliIt.live(
"mid-stream LLM error still exits 0 today (contract lock-in)",
({ llm, opencode }) =>
Effect.gen(function* () {
@@ -61,7 +62,7 @@ describe("opencode run (non-interactive subprocess)", () => {
// --format json puts one JSON object per line on stdout for each emitted
// event. Consumers (CI scripts, tooling) parse this stream. Asserts the
// shape so a future event-emit change has to update this expectation.
cliIt.concurrent(
cliIt.live(
"--format json emits parseable line-delimited JSON to stdout",
({ llm, opencode }) =>
Effect.gen(function* () {