| 51 | // that publish to an in-process HTTP server and need pub/sub identity with |
| 52 | // the server's handlers. |
| 53 | const 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 | |
| 67 | const 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) => |