| 8 | const layer = Layer.mergeAll(TestConsole.layer, TestClock.layer()) |
| 9 | |
| 10 | const effect = <A, E>(name: string, body: Body<A, E, Scope>, options?: Parameters<typeof test>[2]) => |
| 11 | test( |
| 12 | name, |
| 13 | () => |
| 14 | Effect.gen(function* () { |
| 15 | const exit = yield* Effect.suspend(() => (typeof body === "function" ? body() : body)).pipe( |
| 16 | Effect.scoped, |
| 17 | Effect.provide(layer), |
| 18 | Effect.exit, |
| 19 | ) |
| 20 | if (Exit.isFailure(exit)) { |
| 21 | yield* Effect.forEach(Cause.prettyErrors(exit.cause), Effect.logError, { discard: true }) |
| 22 | } |
| 23 | return yield* exit |
| 24 | }).pipe(Effect.runPromise), |
| 25 | options, |
| 26 | ) |
| 27 | |
| 28 | export const it = { effect } |