mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-24 22:14:37 +00:00
test: dispose tmpdir instances explicitly
This commit is contained in:
parent
b1cb71856e
commit
03035bb181
1 changed files with 5 additions and 2 deletions
|
|
@ -193,8 +193,11 @@ export const withTmpdirInstance =
|
|||
<A, E, R>(self: Effect.Effect<A, E, R>) =>
|
||||
Effect.gen(function* () {
|
||||
const directory = yield* tmpdirScoped(options)
|
||||
return yield* InstanceStore.Service.use((store) =>
|
||||
store.provide({ directory }, self.pipe(Effect.provideService(TestInstance, { directory }))),
|
||||
const store = yield* InstanceStore.Service
|
||||
return yield* Effect.acquireUseRelease(
|
||||
store.load({ directory }),
|
||||
(ctx) => self.pipe(Effect.provideService(TestInstance, { directory }), Effect.provideService(InstanceRef, ctx)),
|
||||
(ctx) => store.dispose(ctx).pipe(Effect.ignore),
|
||||
)
|
||||
}).pipe(
|
||||
Effect.provide(InstanceStore.defaultLayer.pipe(Layer.provide(noopBootstrap))),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue