MCPcopy
hub / github.com/anomalyco/opencode / make

Function make

packages/opencode/test/lib/effect.ts:67–129  ·  view source on GitHub ↗
(testLayer: Layer.Layer<R, E>, liveLayer: Layer.Layer<R, E>, run: Runner = isolatedRun)

Source from the content-addressed store, hash-verified

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) =>
69 test(name, () => run(value, testLayer), opts)
70
71 effect.only = <A, E2>(name: string, value: Body<A, E2, R | Scope.Scope>, opts?: number | TestOptions) =>
72 test.only(name, () => run(value, testLayer), opts)
73
74 effect.skip = <A, E2>(name: string, value: Body<A, E2, R | Scope.Scope>, opts?: number | TestOptions) =>
75 test.skip(name, () => run(value, testLayer), opts)
76
77 const live = <A, E2>(name: string, value: Body<A, E2, R | Scope.Scope>, opts?: number | TestOptions) =>
78 test(name, () => run(value, liveLayer), opts)
79
80 live.only = <A, E2>(name: string, value: Body<A, E2, R | Scope.Scope>, opts?: number | TestOptions) =>
81 test.only(name, () => run(value, liveLayer), opts)
82
83 live.skip = <A, E2>(name: string, value: Body<A, E2, R | Scope.Scope>, opts?: number | TestOptions) =>
84 test.skip(name, () => run(value, liveLayer), opts)
85
86 const instance = <A, E2, E3 = never>(
87 name: string,
88 value: Body<A, E2, R | InstanceStore.Service | TestInstance | Scope.Scope>,
89 options?: InstanceOptions<E3, R | Scope.Scope> | number | TestOptions,
90 opts?: number | TestOptions,
91 ) => {
92 const args = instanceArgs(options, opts)
93 return test(
94 name,
95 () => run(body(value).pipe(withTmpdirInstance(args.instanceOptions)), liveLayer),
96 args.testOptions,
97 )
98 }
99
100 instance.only = <A, E2, E3 = never>(
101 name: string,
102 value: Body<A, E2, R | InstanceStore.Service | TestInstance | Scope.Scope>,
103 options?: InstanceOptions<E3, R | Scope.Scope> | number | TestOptions,
104 opts?: number | TestOptions,
105 ) => {
106 const args = instanceArgs(options, opts)
107 return test.only(
108 name,
109 () => run(body(value).pipe(withTmpdirInstance(args.instanceOptions)), liveLayer),
110 args.testOptions,
111 )
112 }
113
114 instance.skip = <A, E2, E3 = never>(
115 name: string,
116 value: Body<A, E2, R | InstanceStore.Service | TestInstance | Scope.Scope>,
117 options?: InstanceOptions<E3, R | Scope.Scope> | number | TestOptions,
118 opts?: number | TestOptions,
119 ) => {
120 const args = instanceArgs(options, opts)
121 return test.skip(
122 name,
123 () => run(body(value).pipe(withTmpdirInstance(args.instanceOptions)), liveLayer),
124 args.testOptions,

Callers 3

effect.tsFile · 0.70
testEffectFunction · 0.70
testEffectSharedFunction · 0.70

Calls 4

withTmpdirInstanceFunction · 0.90
instanceArgsFunction · 0.85
runFunction · 0.70
bodyFunction · 0.70

Tested by

no test coverage detected