MCPcopy Index your code
hub / github.com/anomalyco/opencode / sharedRun

Function sharedRun

packages/opencode/test/lib/effect.ts:53–65  ·  view source on GitHub ↗
(value, layer)

Source from the content-addressed store, hash-verified

51// that publish to an in-process HTTP server and need pub/sub identity with
52// the server's handlers.
53const sharedRun: Runner = (value, layer) =>
54 Effect.gen(function* () {
55 const scope = yield* Scope.make()
56 const ctx = yield* Layer.buildWithMemoMap(layer, memoMap, scope)
57 const exit = yield* body(value).pipe(Effect.scoped, Effect.provide(ctx), Effect.exit)
58 yield* Scope.close(scope, Exit.void)
59 if (Exit.isFailure(exit)) {
60 for (const err of Cause.prettyErrors(exit.cause)) {
61 yield* Effect.logError(err)
62 }
63 }
64 return yield* exit
65 }).pipe(Effect.runPromise)
66
67const make = <R, E>(testLayer: Layer.Layer<R, E>, liveLayer: Layer.Layer<R, E>, run: Runner = isolatedRun) => {
68 const effect = <A, E2>(name: string, value: Body<A, E2, R | Scope.Scope>, opts?: number | TestOptions) =>

Callers

nothing calls this directly

Calls 3

bodyFunction · 0.70
makeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected