summaryrefslogtreecommitdiffhomepage
path: root/packages/app/e2e/backend.ts
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-04-01 13:43:19 -0400
committerGitHub <[email protected]>2026-04-01 17:43:19 +0000
commitf3f728ec27b2b2fc67470a2acec0072a5f1badd0 (patch)
treed8d36b7721d3e48965cc6fd84587fc533a0349b5 /packages/app/e2e/backend.ts
parentc619caefdd1d184cae549749240c5f77f63b150a (diff)
downloadopencode-f3f728ec27b2b2fc67470a2acec0072a5f1badd0.tar.gz
opencode-f3f728ec27b2b2fc67470a2acec0072a5f1badd0.zip
test(app): fix isolated backend follow-ups (#20513)
Diffstat (limited to 'packages/app/e2e/backend.ts')
-rw-r--r--packages/app/e2e/backend.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/app/e2e/backend.ts b/packages/app/e2e/backend.ts
index 22122a372..4dfa7c64f 100644
--- a/packages/app/e2e/backend.ts
+++ b/packages/app/e2e/backend.ts
@@ -44,6 +44,14 @@ async function waitForHealth(url: string, probe = "/global/health") {
throw new Error(`Timed out waiting for backend health at ${url}${probe}${last ? ` (${last})` : ""}`)
}
+async function waitExit(proc: ReturnType<typeof spawn>, timeout = 10_000) {
+ if (proc.exitCode !== null) return
+ await Promise.race([
+ new Promise<void>((resolve) => proc.once("exit", () => resolve())),
+ new Promise<void>((resolve) => setTimeout(resolve, timeout)),
+ ])
+}
+
const LOG_CAP = 100
function cap(input: string[]) {
@@ -62,7 +70,6 @@ export async function startBackend(label: string): Promise<Handle> {
const opencodeDir = path.join(repoDir, "packages", "opencode")
const env = {
...process.env,
- OPENCODE_DISABLE_SHARE: process.env.OPENCODE_DISABLE_SHARE ?? "true",
OPENCODE_DISABLE_LSP_DOWNLOAD: "true",
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true",
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: "true",
@@ -117,7 +124,11 @@ export async function startBackend(label: string): Promise<Handle> {
async stop() {
if (proc.exitCode === null) {
proc.kill("SIGTERM")
- await new Promise((resolve) => proc.once("exit", () => resolve(undefined))).catch(() => undefined)
+ await waitExit(proc)
+ }
+ if (proc.exitCode === null) {
+ proc.kill("SIGKILL")
+ await waitExit(proc)
}
await fs.rm(sandbox, { recursive: true, force: true }).catch(() => undefined)
},