refactor(core): convert more opencode tests to nodes (#34464)

This commit is contained in:
James Long
2026-06-29 13:56:28 -04:00
committed by GitHub
parent de185559dd
commit d4fd528152
45 changed files with 209 additions and 203 deletions
@@ -1,6 +1,7 @@
import { afterEach, expect } from "bun:test"
import { $ } from "bun"
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import { FSUtil } from "@opencode-ai/core/fs-util"
import fs from "fs/promises"
import path from "path"
@@ -15,7 +16,7 @@ import {
} from "../fixture/fixture"
import { testEffect } from "../lib/effect"
const it = testEffect(Layer.mergeAll(Snapshot.defaultLayer, FSUtil.defaultLayer, testInstanceStoreLayer))
const it = testEffect(Layer.mergeAll(LayerNode.compile(LayerNode.group([Snapshot.node, FSUtil.node])), testInstanceStoreLayer))
// Windows forbids both * and : in directory names.
const nonWindowsIt = process.platform === "win32" ? it.live.skip : it.live
@@ -74,11 +75,11 @@ const withTrackedSnapshot = <A, E, R>(
})
const bootstrapScoped = Effect.fn("SnapshotTest.bootstrapScoped")(function* () {
const dir = yield* tmpdirScoped({ git: true }).pipe(Effect.provide(CrossSpawnSpawner.defaultLayer))
const dir = yield* tmpdirScoped({ git: true }).pipe(Effect.provide(LayerNode.compile(CrossSpawnSpawner.node)))
return { path: dir, extra: yield* initialize(dir) }
})
const scopedGitTmpdir = () => tmpdirScoped({ git: true }).pipe(Effect.provide(CrossSpawnSpawner.defaultLayer))
const scopedGitTmpdir = () => tmpdirScoped({ git: true }).pipe(Effect.provide(LayerNode.compile(CrossSpawnSpawner.node)))
const cleanupWorktree = (repo: string, worktree: string, files: string[] = []) =>
Effect.promise(async () => {