@effect/vitest 0.27.0 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,7 +59,7 @@ To write a test, place your assertions directly within the main effect. This ens
59
59
  In the following example, we test a function that divides two numbers, but fails if the divisor is zero. The goal is to check that the function returns the correct result when given valid input.
60
60
 
61
61
  ```ts
62
- import { it, expect } from "@effect/vitest"
62
+ import { expect, it } from "@effect/vitest"
63
63
  import { Effect } from "effect"
64
64
 
65
65
  // A simple divide function that returns an Effect, failing when dividing by zero
@@ -70,11 +70,10 @@ function divide(a: number, b: number) {
70
70
 
71
71
  // Testing a successful division
72
72
  it.effect("test success", () =>
73
- Effect.gen(function* () {
73
+ Effect.gen(function*() {
74
74
  const result = yield* divide(4, 2) // Expect 4 divided by 2 to succeed
75
75
  expect(result).toBe(2) // Assert that the result is 2
76
- })
77
- )
76
+ }))
78
77
  ```
79
78
 
80
79
  ## Testing Successes and Failures as `Exit`
@@ -84,7 +83,7 @@ When you need to handle both success and failure cases in a test, you can use `E
84
83
  **Example** (Testing Success and Failure with `Exit`)
85
84
 
86
85
  ```ts
87
- import { it, expect } from "@effect/vitest"
86
+ import { expect, it } from "@effect/vitest"
88
87
  import { Effect, Exit } from "effect"
89
88
 
90
89
  // A function that divides two numbers and returns an Effect.
@@ -96,19 +95,17 @@ function divide(a: number, b: number) {
96
95
 
97
96
  // Test case for a successful division, using `Effect.exit` to capture the result
98
97
  it.effect("test success as Exit", () =>
99
- Effect.gen(function* () {
98
+ Effect.gen(function*() {
100
99
  const result = yield* Effect.exit(divide(4, 2)) // Capture the result as an Exit
101
100
  expect(result).toStrictEqual(Exit.succeed(2)) // Expect success with the value 2
102
- })
103
- )
101
+ }))
104
102
 
105
103
  // Test case for a failure (division by zero), using `Effect.exit`
106
104
  it.effect("test failure as Exit", () =>
107
- Effect.gen(function* () {
105
+ Effect.gen(function*() {
108
106
  const result = yield* Effect.exit(divide(4, 0)) // Capture the result as an Exit
109
107
  expect(result).toStrictEqual(Exit.fail("Cannot divide by zero")) // Expect failure with the correct message
110
- })
111
- )
108
+ }))
112
109
  ```
113
110
 
114
111
  ## Using the TestClock
@@ -132,32 +129,29 @@ import { it } from "@effect/vitest"
132
129
  import { Clock, Effect, TestClock } from "effect"
133
130
 
134
131
  // Effect to log the current time
135
- const logNow = Effect.gen(function* () {
132
+ const logNow = Effect.gen(function*() {
136
133
  const now = yield* Clock.currentTimeMillis // Fetch the current time from the clock
137
134
  console.log(now) // Log the current time
138
135
  })
139
136
 
140
137
  // Example of using the real system clock with `it.live`
141
138
  it.live("runs the test with the live Effect environment", () =>
142
- Effect.gen(function* () {
139
+ Effect.gen(function*() {
143
140
  yield* logNow // Prints the actual current time
144
- })
145
- )
141
+ }))
146
142
 
147
143
  // Example of using `it.effect` with the default test environment
148
144
  it.effect("run the test with the test environment", () =>
149
- Effect.gen(function* () {
145
+ Effect.gen(function*() {
150
146
  yield* logNow // Prints 0, as the test clock starts at 0
151
- })
152
- )
147
+ }))
153
148
 
154
149
  // Example of advancing the test clock by 1000 milliseconds
155
150
  it.effect("run the test with the test environment and the time adjusted", () =>
156
- Effect.gen(function* () {
151
+ Effect.gen(function*() {
157
152
  yield* TestClock.adjust("1000 millis") // Move the clock forward by 1000 milliseconds
158
153
  yield* logNow // Prints 1000, reflecting the adjusted time
159
- })
160
- )
154
+ }))
161
155
  ```
162
156
 
163
157
  ## Skipping Tests
@@ -168,8 +162,8 @@ If you need to temporarily disable a test but don't want to delete or comment ou
168
162
 
169
163
  ```ts
170
164
  import { it } from "@effect/vitest"
171
- import { Effect, Exit } from "effect"
172
165
  import { expect } from "@effect/vitest"
166
+ import { Effect, Exit } from "effect"
173
167
 
174
168
  function divide(a: number, b: number) {
175
169
  if (b === 0) return Effect.fail("Cannot divide by zero")
@@ -178,11 +172,10 @@ function divide(a: number, b: number) {
178
172
 
179
173
  // Temporarily skip the test for dividing numbers
180
174
  it.effect.skip("test failure as Exit", () =>
181
- Effect.gen(function* () {
175
+ Effect.gen(function*() {
182
176
  const result = yield* Effect.exit(divide(4, 0))
183
177
  expect(result).toStrictEqual(Exit.fail("Cannot divide by zero"))
184
- })
185
- )
178
+ }))
186
179
  ```
187
180
 
188
181
  ## Running a Single Test
@@ -193,8 +186,8 @@ When you're developing or debugging, it's often useful to run a specific test wi
193
186
 
194
187
  ```ts
195
188
  import { it } from "@effect/vitest"
196
- import { Effect, Exit } from "effect"
197
189
  import { expect } from "@effect/vitest"
190
+ import { Effect, Exit } from "effect"
198
191
 
199
192
  function divide(a: number, b: number) {
200
193
  if (b === 0) return Effect.fail("Cannot divide by zero")
@@ -203,11 +196,10 @@ function divide(a: number, b: number) {
203
196
 
204
197
  // Run only this test, skipping all others
205
198
  it.effect.only("test failure as Exit", () =>
206
- Effect.gen(function* () {
199
+ Effect.gen(function*() {
207
200
  const result = yield* Effect.exit(divide(4, 0))
208
201
  expect(result).toStrictEqual(Exit.fail("Cannot divide by zero"))
209
- })
210
- )
202
+ }))
211
203
  ```
212
204
 
213
205
  ## Expecting Tests to Fail
@@ -227,11 +219,10 @@ function divide(a: number, b: number): number {
227
219
 
228
220
  // Temporarily assert that the test for dividing by zero fails.
229
221
  it.effect.fails("dividing by zero special cases", ({ expect }) =>
230
- Effect.gen(function* () {
222
+ Effect.gen(function*() {
231
223
  const result = yield* Effect.exit(divide(4, 0))
232
224
  expect(result).toStrictEqual(0)
233
- })
234
- )
225
+ }))
235
226
  ```
236
227
 
237
228
  ## Logging
@@ -246,26 +237,23 @@ import { Effect, Logger } from "effect"
246
237
 
247
238
  // This test won't display the log message, as logging is suppressed by default in `it.effect`
248
239
  it.effect("does not display a log", () =>
249
- Effect.gen(function* () {
240
+ Effect.gen(function*() {
250
241
  yield* Effect.log("it.effect") // Log won't be shown
251
- })
252
- )
242
+ }))
253
243
 
254
244
  // This test will display the log because a custom logger is provided
255
245
  it.effect("providing a logger displays a log", () =>
256
- Effect.gen(function* () {
246
+ Effect.gen(function*() {
257
247
  yield* Effect.log("it.effect with custom logger") // Log will be displayed
258
248
  }).pipe(
259
249
  Effect.provide(Logger.pretty) // Providing a pretty logger for log output
260
- )
261
- )
250
+ ))
262
251
 
263
252
  // This test runs using `it.live`, which enables logging by default
264
253
  it.live("it.live displays a log", () =>
265
- Effect.gen(function* () {
254
+ Effect.gen(function*() {
266
255
  yield* Effect.log("it.live") // Log will be displayed
267
- })
268
- )
256
+ }))
269
257
  ```
270
258
 
271
259
  # Writing Tests with `it.scoped`
@@ -287,17 +275,15 @@ const resource = Effect.acquireRelease(acquire, () => release)
287
275
 
288
276
  // Incorrect usage: This will result in a type error because it lacks a scope
289
277
  it.effect("run with scope", () =>
290
- Effect.gen(function* () {
278
+ Effect.gen(function*() {
291
279
  yield* resource
292
- })
293
- )
280
+ }))
294
281
 
295
282
  // Correct usage: Using 'it.scoped' to manage the scope correctly
296
283
  it.scoped("run with scope", () =>
297
- Effect.gen(function* () {
284
+ Effect.gen(function*() {
298
285
  yield* resource
299
- })
300
- )
286
+ }))
301
287
  ```
302
288
 
303
289
  # Writing Tests with `it.flakyTest`
@@ -313,7 +299,7 @@ import { it } from "@effect/vitest"
313
299
  import { Effect, Random } from "effect"
314
300
 
315
301
  // Simulating a flaky effect
316
- const flaky = Effect.gen(function* () {
302
+ const flaky = Effect.gen(function*() {
317
303
  const random = yield* Random.nextBoolean
318
304
  if (random) {
319
305
  return yield* Effect.fail("Failed due to randomness")
@@ -330,7 +316,5 @@ To handle this flakiness, we use `it.flakyTest` to retry the test until it passe
330
316
 
331
317
  ```ts
332
318
  // Retrying the flaky test with a 5-second timeout
333
- it.effect("retrying until success or timeout", () =>
334
- it.flakyTest(flaky, "5 seconds")
335
- )
319
+ it.effect("retrying until success or timeout", () => it.flakyTest(flaky, "5 seconds"))
336
320
  ```
@@ -3,11 +3,10 @@
3
3
  */
4
4
  import type * as Duration from "effect/Duration";
5
5
  import type * as Effect from "effect/Effect";
6
- import type * as FC from "effect/FastCheck";
7
6
  import type * as Layer from "effect/Layer";
8
7
  import type * as Schema from "effect/Schema";
9
8
  import type * as Scope from "effect/Scope";
10
- import type * as TestServices from "effect/TestServices";
9
+ import type * as FC from "effect/testing/FastCheck";
11
10
  import * as V from "vitest";
12
11
  /**
13
12
  * @since 1.0.0
@@ -16,30 +15,7 @@ export * from "vitest";
16
15
  /**
17
16
  * @since 1.0.0
18
17
  */
19
- export type API = {
20
- scopedFixtures: V.TestAPI<{}>["scoped"];
21
- } & {
22
- [K in keyof V.TestAPI<{}>]: K extends "scoped" ? unknown : V.TestAPI<{}>[K];
23
- } & TestCollectorCallable;
24
- interface TestCollectorCallable<C = object> {
25
- /**
26
- * @deprecated Use options as the second argument instead
27
- */
28
- <ExtraContext extends C>(name: string | Function, fn: V.TestFunction<ExtraContext>, options: TestCollectorOptions): void;
29
- <ExtraContext extends C>(name: string | Function, fn?: V.TestFunction<ExtraContext>, options?: number | TestCollectorOptions): void;
30
- <ExtraContext extends C>(name: string | Function, options?: TestCollectorOptions, fn?: V.TestFunction<ExtraContext>): void;
31
- }
32
- type TestCollectorOptions = {
33
- concurrent?: boolean;
34
- sequential?: boolean;
35
- only?: boolean;
36
- skip?: boolean;
37
- todo?: boolean;
38
- fails?: boolean;
39
- timeout?: number;
40
- retry?: number;
41
- repeats?: number;
42
- };
18
+ export type API = V.TestAPI<{}>;
43
19
  /**
44
20
  * @since 1.0.0
45
21
  */
@@ -59,8 +35,8 @@ export declare namespace Vitest {
59
35
  /**
60
36
  * @since 1.0.0
61
37
  */
62
- type Arbitraries = Array<Schema.Schema.Any | FC.Arbitrary<any>> | {
63
- [K in string]: Schema.Schema.Any | FC.Arbitrary<any>;
38
+ type Arbitraries = Array<Schema.Schema<any> | FC.Arbitrary<any>> | {
39
+ [K in string]: Schema.Schema<any> | FC.Arbitrary<any>;
64
40
  };
65
41
  /**
66
42
  * @since 1.0.0
@@ -77,36 +53,35 @@ export declare namespace Vitest {
77
53
  */
78
54
  prop: <const Arbs extends Arbitraries, A, E>(name: string, arbitraries: Arbs, self: TestFunction<A, E, R, [
79
55
  {
80
- [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>;
56
+ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Arbs[K] extends Schema.Schema<infer T> ? T : never;
81
57
  },
82
58
  V.TestContext
83
59
  ]>, timeout?: number | V.TestOptions & {
84
60
  fastCheck?: FC.Parameters<{
85
- [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>;
61
+ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Arbs[K] extends Schema.Schema<infer T> ? T : never;
86
62
  }>;
87
63
  }) => void;
88
64
  }
89
65
  /**
90
66
  * @since 1.0.0
91
67
  */
92
- interface MethodsNonLive<R = never, ExcludeTestServices extends boolean = false> extends API {
93
- readonly effect: Vitest.Tester<(ExcludeTestServices extends true ? never : TestServices.TestServices) | R>;
94
- readonly flakyTest: <A, E, R2>(self: Effect.Effect<A, E, R2>, timeout?: Duration.DurationInput) => Effect.Effect<A, never, R2>;
95
- readonly scoped: Vitest.Tester<(ExcludeTestServices extends true ? never : TestServices.TestServices) | Scope.Scope | R>;
68
+ interface MethodsNonLive<R = never> extends API {
69
+ readonly effect: Vitest.Tester<R | Scope.Scope>;
70
+ readonly flakyTest: <A, E, R2>(self: Effect.Effect<A, E, R2 | Scope.Scope>, timeout?: Duration.DurationInput) => Effect.Effect<A, never, R2>;
96
71
  readonly layer: <R2, E>(layer: Layer.Layer<R2, E, R>, options?: {
97
72
  readonly timeout?: Duration.DurationInput;
98
73
  }) => {
99
- (f: (it: Vitest.MethodsNonLive<R | R2, ExcludeTestServices>) => void): void;
100
- (name: string, f: (it: Vitest.MethodsNonLive<R | R2, ExcludeTestServices>) => void): void;
74
+ (f: (it: Vitest.MethodsNonLive<R | R2>) => void): void;
75
+ (name: string, f: (it: Vitest.MethodsNonLive<R | R2>) => void): void;
101
76
  };
102
77
  /**
103
78
  * @since 1.0.0
104
79
  */
105
80
  readonly prop: <const Arbs extends Arbitraries>(name: string, arbitraries: Arbs, self: (properties: {
106
- [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>;
81
+ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Arbs[K] extends Schema.Schema<infer T> ? T : never;
107
82
  }, ctx: V.TestContext) => void, timeout?: number | V.TestOptions & {
108
83
  fastCheck?: FC.Parameters<{
109
- [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Schema.Schema.Type<Arbs[K]>;
84
+ [K in keyof Arbs]: Arbs[K] extends FC.Arbitrary<infer T> ? T : Arbs[K] extends Schema.Schema<infer T> ? T : never;
110
85
  }>;
111
86
  }) => void;
112
87
  }
@@ -114,8 +89,7 @@ export declare namespace Vitest {
114
89
  * @since 1.0.0
115
90
  */
116
91
  interface Methods<R = never> extends MethodsNonLive<R> {
117
- readonly live: Vitest.Tester<R>;
118
- readonly scopedLive: Vitest.Tester<Scope.Scope | R>;
92
+ readonly live: Vitest.Tester<Scope.Scope | R>;
119
93
  }
120
94
  }
121
95
  /**
@@ -125,19 +99,11 @@ export declare const addEqualityTesters: () => void;
125
99
  /**
126
100
  * @since 1.0.0
127
101
  */
128
- export declare const effect: Vitest.Tester<TestServices.TestServices>;
102
+ export declare const effect: Vitest.Tester<Scope.Scope>;
129
103
  /**
130
104
  * @since 1.0.0
131
105
  */
132
- export declare const scoped: Vitest.Tester<TestServices.TestServices | Scope.Scope>;
133
- /**
134
- * @since 1.0.0
135
- */
136
- export declare const live: Vitest.Tester<never>;
137
- /**
138
- * @since 1.0.0
139
- */
140
- export declare const scopedLive: Vitest.Tester<Scope.Scope>;
106
+ export declare const live: Vitest.Tester<Scope.Scope>;
141
107
  /**
142
108
  * Share a `Layer` between multiple tests, optionally wrapping
143
109
  * the tests in a `describe` block if a name is provided.
@@ -146,13 +112,13 @@ export declare const scopedLive: Vitest.Tester<Scope.Scope>;
146
112
  *
147
113
  * ```ts
148
114
  * import { expect, layer } from "@effect/vitest"
149
- * import { Context, Effect, Layer } from "effect"
115
+ * import { Effect, Layer, ServiceMap } from "effect"
150
116
  *
151
- * class Foo extends Context.Tag("Foo")<Foo, "foo">() {
117
+ * class Foo extends ServiceMap.Service("Foo")<Foo, "foo">() {
152
118
  * static Live = Layer.succeed(Foo, "foo")
153
119
  * }
154
120
  *
155
- * class Bar extends Context.Tag("Bar")<Bar, "bar">() {
121
+ * class Bar extends ServiceMap.Service("Bar")<Bar, "bar">() {
156
122
  * static Live = Layer.effect(
157
123
  * Bar,
158
124
  * Effect.map(Foo, () => "bar" as const)
@@ -161,37 +127,35 @@ export declare const scopedLive: Vitest.Tester<Scope.Scope>;
161
127
  *
162
128
  * layer(Foo.Live)("layer", (it) => {
163
129
  * it.effect("adds context", () =>
164
- * Effect.gen(function* () {
130
+ * Effect.gen(function*() {
165
131
  * const foo = yield* Foo
166
132
  * expect(foo).toEqual("foo")
167
- * })
168
- * )
133
+ * }))
169
134
  *
170
135
  * it.layer(Bar.Live)("nested", (it) => {
171
136
  * it.effect("adds context", () =>
172
- * Effect.gen(function* () {
137
+ * Effect.gen(function*() {
173
138
  * const foo = yield* Foo
174
139
  * const bar = yield* Bar
175
140
  * expect(foo).toEqual("foo")
176
141
  * expect(bar).toEqual("bar")
177
- * })
178
- * )
142
+ * }))
179
143
  * })
180
144
  * })
181
145
  * ```
182
146
  */
183
- export declare const layer: <R, E, const ExcludeTestServices extends boolean = false>(layer_: Layer.Layer<R, E>, options?: {
147
+ export declare const layer: <R, E>(layer_: Layer.Layer<R, E>, options?: {
184
148
  readonly memoMap?: Layer.MemoMap;
185
149
  readonly timeout?: Duration.DurationInput;
186
- readonly excludeTestServices?: ExcludeTestServices;
150
+ readonly excludeTestServices?: boolean;
187
151
  }) => {
188
- (f: (it: Vitest.MethodsNonLive<R, ExcludeTestServices>) => void): void;
189
- (name: string, f: (it: Vitest.MethodsNonLive<R, ExcludeTestServices>) => void): void;
152
+ (f: (it: Vitest.MethodsNonLive<R>) => void): void;
153
+ (name: string, f: (it: Vitest.MethodsNonLive<R>) => void): void;
190
154
  };
191
155
  /**
192
156
  * @since 1.0.0
193
157
  */
194
- export declare const flakyTest: <A, E, R>(self: Effect.Effect<A, E, R>, timeout?: Duration.DurationInput) => Effect.Effect<A, never, R>;
158
+ export declare const flakyTest: <A, E, R>(self: Effect.Effect<A, E, R | Scope.Scope>, timeout?: Duration.DurationInput) => Effect.Effect<A, never, R>;
195
159
  /**
196
160
  * @since 1.0.0
197
161
  */
@@ -203,7 +167,7 @@ export declare const it: Vitest.Methods;
203
167
  /**
204
168
  * @since 1.0.0
205
169
  */
206
- export declare const makeMethods: (it: API) => Vitest.Methods;
170
+ export declare const makeMethods: (it: V.TestAPI) => Vitest.Methods;
207
171
  /**
208
172
  * @since 1.0.0
209
173
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAA;AAG3B;;GAEG;AACH,cAAc,QAAQ,CAAA;AAEtB;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAE/B;;GAEG;AACH,yBAAiB,MAAM,CAAC;IACtB;;OAEG;IACH,UAAi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,EAAE,OAAO,CAAA;CACvC,KACE;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,CAAA;IACjD,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,CAAA;CAC/C,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,EAC1C,OAAO,CAAC,EAAE,QAAQ,CAAC,aAAa,KAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAsB,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAiB,CAAA;AASzD;;GAEG;AACH,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,OAAsC,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,OAA8B,CAAA;AAElF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,cACzD,CAAA"}
@@ -12,18 +12,10 @@ export const addEqualityTesters = internal.addEqualityTesters;
12
12
  * @since 1.0.0
13
13
  */
14
14
  export const effect = internal.effect;
15
- /**
16
- * @since 1.0.0
17
- */
18
- export const scoped = internal.scoped;
19
15
  /**
20
16
  * @since 1.0.0
21
17
  */
22
18
  export const live = internal.live;
23
- /**
24
- * @since 1.0.0
25
- */
26
- export const scopedLive = internal.scopedLive;
27
19
  /**
28
20
  * Share a `Layer` between multiple tests, optionally wrapping
29
21
  * the tests in a `describe` block if a name is provided.
@@ -32,13 +24,13 @@ export const scopedLive = internal.scopedLive;
32
24
  *
33
25
  * ```ts
34
26
  * import { expect, layer } from "@effect/vitest"
35
- * import { Context, Effect, Layer } from "effect"
27
+ * import { Effect, Layer, ServiceMap } from "effect"
36
28
  *
37
- * class Foo extends Context.Tag("Foo")<Foo, "foo">() {
29
+ * class Foo extends ServiceMap.Service("Foo")<Foo, "foo">() {
38
30
  * static Live = Layer.succeed(Foo, "foo")
39
31
  * }
40
32
  *
41
- * class Bar extends Context.Tag("Bar")<Bar, "bar">() {
33
+ * class Bar extends ServiceMap.Service("Bar")<Bar, "bar">() {
42
34
  * static Live = Layer.effect(
43
35
  * Bar,
44
36
  * Effect.map(Foo, () => "bar" as const)
@@ -47,21 +39,19 @@ export const scopedLive = internal.scopedLive;
47
39
  *
48
40
  * layer(Foo.Live)("layer", (it) => {
49
41
  * it.effect("adds context", () =>
50
- * Effect.gen(function* () {
42
+ * Effect.gen(function*() {
51
43
  * const foo = yield* Foo
52
44
  * expect(foo).toEqual("foo")
53
- * })
54
- * )
45
+ * }))
55
46
  *
56
47
  * it.layer(Bar.Live)("nested", (it) => {
57
48
  * it.effect("adds context", () =>
58
- * Effect.gen(function* () {
49
+ * Effect.gen(function*() {
59
50
  * const foo = yield* Foo
60
51
  * const bar = yield* Bar
61
52
  * expect(foo).toEqual("foo")
62
53
  * expect(bar).toEqual("bar")
63
- * })
64
- * )
54
+ * }))
65
55
  * })
66
56
  * })
67
57
  * ```
@@ -83,18 +73,13 @@ const methods = {
83
73
  effect,
84
74
  live,
85
75
  flakyTest,
86
- scoped,
87
- scopedLive,
88
76
  layer,
89
77
  prop
90
78
  };
91
79
  /**
92
80
  * @since 1.0.0
93
81
  */
94
- export const it = /*#__PURE__*/Object.assign(V.it, {
95
- ...methods,
96
- scopedFixtures: /*#__PURE__*/V.it.scoped.bind(V.it)
97
- });
82
+ export const it = /*#__PURE__*/Object.assign(V.it, methods);
98
83
  /**
99
84
  * @since 1.0.0
100
85
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["V","internal","addEqualityTesters","effect","live","layer","flakyTest","prop","methods","it","Object","assign","makeMethods","describeWrapped"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AASA,OAAO,KAAKA,CAAC,MAAM,QAAQ;AAC3B,OAAO,KAAKC,QAAQ,MAAM,wBAAwB;AAElD;;;AAGA,cAAc,QAAQ;AAsItB;;;AAGA,OAAO,MAAMC,kBAAkB,GAAeD,QAAQ,CAACC,kBAAkB;AAEzE;;;AAGA,OAAO,MAAMC,MAAM,GAA+BF,QAAQ,CAACE,MAAM;AAEjE;;;AAGA,OAAO,MAAMC,IAAI,GAA+BH,QAAQ,CAACG,IAAI;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,OAAO,MAAMC,KAAK,GAUdJ,QAAQ,CAACI,KAAK;AAElB;;;AAGA,OAAO,MAAMC,SAAS,GAGYL,QAAQ,CAACK,SAAS;AAEpD;;;AAGA,OAAO,MAAMC,IAAI,GAA2BN,QAAQ,CAACM,IAAI;AAEzD;;;AAIA;AACA,MAAMC,OAAO,GAAG;EAAEL,MAAM;EAAEC,IAAI;EAAEE,SAAS;EAAED,KAAK;EAAEE;AAAI,CAAW;AAEjE;;;AAGA,OAAO,MAAME,EAAE,gBAAmBC,MAAM,CAACC,MAAM,CAACX,CAAC,CAACS,EAAE,EAAED,OAAO,CAAC;AAE9D;;;AAGA,OAAO,MAAMI,WAAW,GAAsCX,QAAQ,CAACW,WAAW;AAElF;;;AAGA,OAAO,MAAMC,eAAe,GAC1BZ,QAAQ,CAACY,eAAe","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal/internal.ts"],"names":[],"mappings":"AAAA;;GAEG"}