MCPcopy Create free account
hub / github.com/anomalyco/opencode / effect

Function effect

packages/httpapi-codegen/test/effect.ts:10–26  ·  view source on GitHub ↗
(name: string, body: Body<A, E, Scope>, options?: Parameters<typeof test>[2])

Source from the content-addressed store, hash-verified

8const layer = Layer.mergeAll(TestConsole.layer, TestClock.layer())
9
10const 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
28export const it = { effect }

Callers

nothing calls this directly

Calls 2

testFunction · 0.85
bodyFunction · 0.50

Tested by

no test coverage detected