Skip to content

Commit b88f325

Browse files
anandgupta42claude
andcommitted
test: symlinkScoped uses the injected FileSystem service
Consistent with its sibling `writeFileStringScoped`: single service acquisition, no raw `node:fs/promises` dynamic imports; removal via `fs.remove(force)` in the scope finalizer. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 78a9ddc commit b88f325

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎packages/opencode/test/lib/filesystem.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ export const writeFileStringScoped = Effect.fn("test.writeFileStringScoped")(fun
1212
/** Create a symlink whose removal is guaranteed by the test scope, even when
1313
* an assertion fails mid-test (finalizers run on scope close regardless). */
1414
export const symlinkScoped = Effect.fn("test.symlinkScoped")(function* (target: string, link: string) {
15-
yield* Effect.promise(() => import("node:fs/promises").then((nfs) => nfs.symlink(target, link)))
16-
yield* Effect.addFinalizer(() =>
17-
Effect.promise(() => import("node:fs/promises").then((nfs) => nfs.unlink(link).catch(() => {}))),
18-
)
15+
const fs = yield* FileSystem.FileSystem
16+
yield* fs.symlink(target, link)
17+
yield* Effect.addFinalizer(() => fs.remove(link, { force: true }).pipe(Effect.orDie))
1918
return link
2019
})

0 commit comments

Comments
 (0)