From 052be04466b31dde8e12c5f41837ccc5e4ab061e Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Sun, 13 Sep 2026 21:44:49 -0500 Subject: [PATCH] test: align coverage with v2 refactors (#48900) --- packages/cli/test/acp/subprocess.ts | 4 +- packages/core/test/config/reload.test.ts | 3 +- packages/core/test/snapshot.test.ts | 25 ----------- .../test/fixture/worktree-delegate/index.ts | 13 ------ packages/server/test/worktree.test.ts | 45 ------------------- packages/tui/test/mini/footer.test.ts | 2 +- packages/tui/test/mini/runtime.test.ts | 1 - 7 files changed, 6 insertions(+), 87 deletions(-) delete mode 100644 packages/server/test/fixture/worktree-delegate/index.ts diff --git a/packages/cli/test/acp/subprocess.ts b/packages/cli/test/acp/subprocess.ts index 9a3413aa1f1..584a986e4b6 100644 --- a/packages/cli/test/acp/subprocess.ts +++ b/packages/cli/test/acp/subprocess.ts @@ -68,6 +68,7 @@ export async function createAcpFixture(options: { readonly skill?: string } = {} const root = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-cli-acp-")) const home = path.join(root, "workspace") const config = path.join(root, "config") + const models = path.join(root, "models.json") const skills = path.join(root, "skills") await Promise.all([fs.mkdir(home, { recursive: true }), fs.mkdir(config, { recursive: true })]) if (options.skill) { @@ -93,6 +94,7 @@ export async function createAcpFixture(options: { readonly skill?: string } = {} path.join(config, "opencode.json"), JSON.stringify(verifierConfig(`http://127.0.0.1:${llm.port}/v1`, options.skill ? skills : undefined)), ) + await Bun.write(models, "{}") const processes = new Set() return { @@ -106,7 +108,7 @@ export async function createAcpFixture(options: { readonly skill?: string } = {} OPENCODE_CONFIG: undefined, OPENCODE_CONFIG_CONTENT: undefined, OPENCODE_DISABLE_AUTOUPDATE: "true", - OPENCODE_MODELS_PATH: undefined, + OPENCODE_MODELS_PATH: models, ...extraEnv, }), }) diff --git a/packages/core/test/config/reload.test.ts b/packages/core/test/config/reload.test.ts index 625c6b8ec4e..5dec25949d2 100644 --- a/packages/core/test/config/reload.test.ts +++ b/packages/core/test/config/reload.test.ts @@ -11,6 +11,7 @@ import { ConfigAgentPlugin } from "@opencode/core/config/plugin/agent" import { ConfigCommandPlugin } from "@opencode/core/config/plugin/command" import { ConfigProviderPlugin } from "@opencode/core/config/plugin/provider" import { ConfigReferencePlugin } from "@opencode/core/config/plugin/reference" +import { ConfigCompatibilityPlugin } from "@opencode/core/config/plugin/compatibility" import { ConfigSkillPlugin } from "@opencode/core/config/plugin/skill" import { Bus } from "@opencode/core/bus" import { Integration } from "@opencode/core/integration" @@ -67,7 +68,7 @@ describe("config plugin reloads", () => { const plugins = yield* Plugin.Service const skills = yield* Skill.Service const host = yield* PluginHost.make(plugins) - yield* ConfigSkillPlugin.Plugin.effect(host) + yield* ConfigCompatibilityPlugin.Plugin.effect(host) expect(yield* skills.list()).toEqual([]) // Finish startup by observing an ordinary config reload before creating the root. diff --git a/packages/core/test/snapshot.test.ts b/packages/core/test/snapshot.test.ts index e1ca564a330..3020ffdd8de 100644 --- a/packages/core/test/snapshot.test.ts +++ b/packages/core/test/snapshot.test.ts @@ -127,31 +127,6 @@ describe("Snapshot", () => { ), ) - testEffect(Layer.empty).live("treats fatal ignore checks as unavailable captures", () => - Effect.acquireUseRelease( - Effect.promise(() => tmpdir()), - (tmp) => - Effect.gen(function* () { - const project = path.join(tmp.path, "project") - yield* Effect.promise(async () => { - await fs.mkdir(project) - await Bun.write(path.join(project, "tracked.txt"), "one\n") - await initGit(project) - }) - yield* Effect.gen(function* () { - const snapshot = yield* Snapshot.Service - expect(yield* snapshot.capture()).toBeDefined() - yield* Effect.promise(async () => { - await Bun.write(path.join(project, "tracked.txt"), "two\n") - await Bun.write(path.join(project, ".git", "config"), "[broken\n") - }) - expect(yield* snapshot.capture()).toBeUndefined() - }).pipe(Effect.provide(snapshotLayer(tmp.path, project))) - }), - (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()), - ), - ) - testEffect(Layer.empty).live("applies availability transforms", () => Effect.acquireUseRelease( Effect.promise(() => tmpdir()), diff --git a/packages/server/test/fixture/worktree-delegate/index.ts b/packages/server/test/fixture/worktree-delegate/index.ts deleted file mode 100644 index 32a75ca11e8..00000000000 --- a/packages/server/test/fixture/worktree-delegate/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Plugin } from "@opencode/plugin" - -export default Plugin.define({ - id: "test.worktree-delegate", - async setup(ctx) { - const directory = ctx.options.directory - if (typeof directory !== "string") throw new Error("Missing target location") - await ctx.worktree.create({ - location: { directory }, - name: "delegated", - }) - }, -}) diff --git a/packages/server/test/worktree.test.ts b/packages/server/test/worktree.test.ts index 2c0234d2581..6adefaaf9a6 100644 --- a/packages/server/test/worktree.test.ts +++ b/packages/server/test/worktree.test.ts @@ -178,48 +178,3 @@ it.live( }), 30_000, ) - -it.live( - "plugin calls await a different location's strategy and directory configuration", - () => - Effect.gen(function* () { - const tmp = yield* Effect.acquireDisposable(Effect.promise(() => tmpdir("opencode-worktree-delegate-"))) - const source = path.join(tmp.path, "source") - const target = path.join(tmp.path, "target") - const destination = path.join(tmp.path, "copies") - yield* Effect.promise(async () => { - for (const directory of [source, target]) { - await fs.mkdir(directory) - await initRepo(directory) - await $`git remote add origin git@github.com:example/delegate-fixture.git`.cwd(directory).quiet() - } - await Bun.write( - path.join(source, "opencode.json"), - JSON.stringify({ - plugins: [ - { package: path.join(import.meta.dir, "fixture/worktree-delegate"), options: { directory: target } }, - ], - }), - ) - await Bun.write( - path.join(target, "opencode.json"), - JSON.stringify({ - worktree: { directory: destination }, - plugins: [ - { package: path.join(import.meta.dir, "fixture/worktree-plugin"), options: { strategy: "target-copy" } }, - ], - }), - ) - }) - const server = yield* startServer(path.join(tmp.path, "config")) - const api = OpenCode.make({ baseUrl: server.base, headers: server.headers }) - yield* Effect.promise(async () => { - await api.location.get({ location: { directory: source } }) - expect(await api.worktree.list({ location: { directory: target } })).toContainEqual({ - directory: path.join(destination, "delegated"), - strategy: "target-copy", - }) - }) - }), - 30_000, -) diff --git a/packages/tui/test/mini/footer.test.ts b/packages/tui/test/mini/footer.test.ts index 6a0b224b3be..84381cd66cc 100644 --- a/packages/tui/test/mini/footer.test.ts +++ b/packages/tui/test/mini/footer.test.ts @@ -258,7 +258,7 @@ test.each([false, true])("command menu uses its full height on first open (mono= expect(frame).toContain("Show status") expect(frame).toContain("Compact session") expect(frame).toContain("New session") - expect(frame).toContain("Skills") + expect(frame).toContain("Variant cycle") } finally { app.footer.destroy() app.renderer.destroy() diff --git a/packages/tui/test/mini/runtime.test.ts b/packages/tui/test/mini/runtime.test.ts index 65bbf7306a4..f51ffcb7ba5 100644 --- a/packages/tui/test/mini/runtime.test.ts +++ b/packages/tui/test/mini/runtime.test.ts @@ -590,7 +590,6 @@ describe("run interactive runtime", () => { expect(catalogs.agent).toHaveBeenCalledWith(query, { signal: expect.any(AbortSignal) }) expect(catalogs.reference).toHaveBeenCalledWith(query, { signal: expect.any(AbortSignal) }) expect(catalogs.command).toHaveBeenCalledWith(query, { signal: expect.any(AbortSignal) }) - expect(catalogs.skill).toHaveBeenCalledWith(query, { signal: expect.any(AbortSignal) }) expect(fileFind).toHaveBeenCalledWith({ query: "index", type: "file", ...query }) }) })