Skip to content

Commit f7f2d97

Browse files
committed
test(app): fix e2e
1 parent 97e0e79 commit f7f2d97

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

‎packages/app/script/e2e-local.ts‎

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,33 @@ await log.Log.init({
111111
})
112112

113113
const servermod = await import("../../opencode/src/server/server")
114+
const inst = await import("../../opencode/src/project/instance")
114115
const server = servermod.Server.listen({ port: serverPort, hostname: "127.0.0.1" })
115116
console.log(`opencode server listening on http://127.0.0.1:${serverPort}`)
116117

117-
try {
118-
await waitForHealth(`http://127.0.0.1:${serverPort}/global/health`)
118+
const result = await (async () => {
119+
try {
120+
await waitForHealth(`http://127.0.0.1:${serverPort}/global/health`)
119121

120-
const runner = Bun.spawn(["bun", "test:e2e", ...extraArgs], {
121-
cwd: appDir,
122-
env: runnerEnv,
123-
stdout: "inherit",
124-
stderr: "inherit",
125-
})
122+
const runner = Bun.spawn(["bun", "test:e2e", ...extraArgs], {
123+
cwd: appDir,
124+
env: runnerEnv,
125+
stdout: "inherit",
126+
stderr: "inherit",
127+
})
128+
129+
return { code: await runner.exited }
130+
} catch (error) {
131+
return { error }
132+
} finally {
133+
await inst.Instance.disposeAll()
134+
await server.stop()
135+
}
136+
})()
126137

127-
process.exitCode = await runner.exited
128-
} finally {
129-
await server.stop()
138+
if ("error" in result) {
139+
console.error(result.error)
140+
process.exit(1)
130141
}
142+
143+
process.exit(result.code)

0 commit comments

Comments
 (0)