diff --git a/packages/cli/test/server-connection.test.ts b/packages/cli/test/server-connection.test.ts index 33fa8abb347..4174fb72b2b 100644 --- a/packages/cli/test/server-connection.test.ts +++ b/packages/cli/test/server-connection.test.ts @@ -8,7 +8,6 @@ import os from "node:os" import path from "node:path" import { ServerConnection } from "../src/services/server-connection" import { ServiceConfig } from "../src/services/service-config" -import { isolatedEnv } from "./fixture/environment" test("resolution groups Effect-native lifecycle operations only for the managed service", async () => { const root = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-server-resolution-")) @@ -70,61 +69,3 @@ test("service options only require a matching version when requested", async () await fs.rm(root, { recursive: true, force: true }) } }) - -test("disabled background service creates a private server per CLI call without registering a daemon", async () => { - const root = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-service-disabled-")) - const env = isolatedEnv(root) - const command = [process.execPath, path.join(import.meta.dir, "../src/index.ts")] - const execute = async (...args: string[]) => { - const child = Bun.spawn([...command, ...args], { - cwd: path.join(import.meta.dir, ".."), - env, - stdout: "pipe", - stderr: "pipe", - }) - const [stdout, stderr, exit] = await Promise.all([ - new Response(child.stdout).text(), - new Response(child.stderr).text(), - child.exited, - ]) - return { stdout, stderr, exit } - } - const run = async (...args: string[]) => { - const { stdout, stderr, exit } = await execute(...args) - expect(exit, stderr).toBe(0) - expect(stderr).not.toContain("Starting background server") - return stdout - } - - try { - await run("service", "set", "disabled", "true") - expect(await run("service", "get", "disabled")).toBe("true\n") - const first = JSON.parse(await run("api", "get", "/api/info")) - const second = JSON.parse(await run("api", "get", "/api/info")) - expect(first.pid).toBeGreaterThan(0) - expect(second.pid).toBeGreaterThan(0) - expect(second.pid).not.toBe(first.pid) - expect(await run("mcp", "list")).toContain("No MCP servers configured") - const pairing = await execute("pair") - expect(pairing.exit).not.toBe(0) - expect(pairing.stderr).toContain("Pairing requires the background service") - - const explicit = Bun.serve({ - port: 0, - fetch() { - return Response.json({ version: OPENCODE_VERSION, pid: 12345, urls: [] }) - }, - }) - try { - expect(JSON.parse(await run("api", "--server", explicit.url.toString(), "get", "/api/info")).pid).toBe(12345) - } finally { - await explicit.stop(true) - } - expect(await fs.readdir(path.join(root, "state", "opencode")).catch(() => [])).toEqual([]) - - await run("service", "unset", "disabled") - expect(await run("service", "get", "disabled")).toBe("false\n") - } finally { - await fs.rm(root, { recursive: true, force: true }) - } -}, 30_000) diff --git a/packages/tui/test/stats.view.test.tsx b/packages/tui/test/stats.view.test.tsx index d061c1a783c..4507dda3416 100644 --- a/packages/tui/test/stats.view.test.tsx +++ b/packages/tui/test/stats.view.test.tsx @@ -4,8 +4,11 @@ import { Global } from "@opencode/util/global" import { Effect, FileSystem } from "effect" import { createEventStream, createFetch, json } from "./fixture/tui-client" import { tmpdir } from "./fixture/fixture" +import { takeDraft } from "../src/component/prompt/draft-stash" test("stats shows only this year and returns after errors or success", async () => { + // Other app tests can leave a home draft in the process-wide stash. + takeDraft(undefined) await using state = await tmpdir() const setup = await createTestRenderer({ width: 100, height: 34, useThread: false, kittyKeyboard: true }) setup.renderer.start()