test(cli): synchronize ACP EOF assertion
This commit is contained in:
parent
7f82a388de
commit
e5f380cb97
2 changed files with 4 additions and 2 deletions
|
|
@ -10,7 +10,9 @@ import { createAcpFixture, expectOk, initialize, newSession, selectConfigOption
|
||||||
describe("acp lifecycle subprocess", () => {
|
describe("acp lifecycle subprocess", () => {
|
||||||
test("stdin EOF exits cleanly", async () => {
|
test("stdin EOF exits cleanly", async () => {
|
||||||
await using fixture = await createAcpFixture()
|
await using fixture = await createAcpFixture()
|
||||||
expect(await fixture.spawn().close()).toBe(0)
|
const acp = fixture.spawn()
|
||||||
|
await initialize(acp)
|
||||||
|
expect(await acp.close()).toBe(0)
|
||||||
}, 60_000)
|
}, 60_000)
|
||||||
|
|
||||||
test("close capability and close request", async () => {
|
test("close capability and close request", async () => {
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ function spawnAcp(input: { readonly env: Record<string, string | undefined> }):
|
||||||
inputClosed = true
|
inputClosed = true
|
||||||
await child.stdin.end()
|
await child.stdin.end()
|
||||||
}
|
}
|
||||||
const exitCode = await withTimeout(child.exited, 45_000, "ACP did not exit after stdin EOF")
|
const exitCode = await withTimeout(child.exited, 5_000, "ACP did not exit after stdin EOF")
|
||||||
await Promise.all([output, errors])
|
await Promise.all([output, errors])
|
||||||
if (exitCode !== 0) throw new Error(`ACP exited with ${exitCode}: ${stderr}`)
|
if (exitCode !== 0) throw new Error(`ACP exited with ${exitCode}: ${stderr}`)
|
||||||
return exitCode
|
return exitCode
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue