@systemfsoftware/vitest 0.0.0 → 0.1.0

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/dist/index.d.ts CHANGED
@@ -1,131 +1,19 @@
1
1
  /// <reference types="./compat.d.ts" />
2
- import { n as NarrowVacuousName, r as PresenceRefusal, t as NarrowNegatedName } from "./refusals-_6e3GzVK.js";
2
+ import { a as Expect, c as NoCheckRefusal, d as RefuseSyncBody, f as ScopedLaneRefusal, i as Checks, l as RefuseAsyncBody, m as UnprovidedRefusal, o as EffectLaneRefusal, p as ScopedLiveLaneRefusal, r as Check, s as HookRefusal, t as Asserted, u as RefuseEffectBody } from "./checks-DiuzHhQM.js";
3
3
  import * as V from "vitest";
4
- import * as Context from "effect/Context";
5
- import { Schema } from "effect";
6
- import * as Effect from "effect/Effect";
4
+ import { afterAll, assertType, beforeAll, expectTypeOf, inject, onTestFailed, onTestFinished, recordArtifact, vi, vitest } from "vitest";
7
5
  import * as Cause from "effect/Cause";
8
6
  import * as Duration from "effect/Duration";
7
+ import * as Effect from "effect/Effect";
9
8
  import * as Layer from "effect/Layer";
10
- import * as Scheduler from "effect/Scheduler";
11
9
  import * as Schema$1 from "effect/Schema";
12
10
  import * as Scope from "effect/Scope";
13
- import * as TestClock from "effect/testing/TestClock";
14
11
  import * as TestConsole from "effect/testing/TestConsole";
12
+ import * as Context from "effect/Context";
13
+ import { Schema } from "effect";
15
14
  import * as Arbitrary from "effect/unstable/arbitrary/Arbitrary";
16
15
  import * as Clock from "effect/Clock";
17
- export * from "vitest";
18
- declare namespace expect_d_exports {
19
- export { Lawful, LawfulCheck, LawfulExpectStatic, LawfulNot, afterAll$1 as afterAll, afterEach$1 as afterEach, beforeAll$1 as beforeAll, beforeEach$1 as beforeEach, check, expect$1 as expect };
20
- }
21
- type Assertion<A> = V.Assertion<void, A>;
22
- /**
23
- * Vitest's matchers for a value of type `A`, with the narrowed ones answering the refusal instead. `toBe` on
24
- * an object, `toBeTypeOf` and `toBeInstanceOf` stay legal (R9).
25
- *
26
- * @internal
27
- */
28
- type Lawful<A> = Omit<Assertion<A>, 'not' | NarrowVacuousName> & { readonly [Name in NarrowVacuousName]: PresenceRefusal<Name>; } & {
29
- readonly not: LawfulNot<A>;
30
- };
31
- /**
32
- * @internal
33
- */
34
- type LawfulNot<A> = Omit<Assertion<A>, 'not' | NarrowNegatedName> & { readonly [Name in NarrowNegatedName]: PresenceRefusal<Name>; };
35
- /**
36
- * @internal
37
- */
38
- interface LawfulCheck {
39
- <A>(actual: A, message?: string): Lawful<A>;
40
- <A>(message?: string): (actual: A) => Lawful<A>;
41
- }
42
- /**
43
- * Vitest's `expect` statics with the narrowed call signature and the fork's soft `soft`.
44
- *
45
- * @internal
46
- */
47
- type LawfulExpectStatic = LawfulCheck & {
48
- readonly soft: LawfulCheck;
49
- } & { readonly [K in Exclude<keyof V.ExpectStatic, 'soft'>]: V.ExpectStatic[K]; };
50
- /**
51
- * The pipeable form of a check: `check(actual, message)` and `check(message)(actual)`.
52
- *
53
- * @internal
54
- */
55
- declare const check: {
56
- <A>(actual: A, message?: string): Lawful<A>;
57
- <A>(message?: string): (actual: A) => Lawful<A>;
58
- };
59
- /**
60
- * The fork's `expect`: soft within one Effect step, refusing the slop forms.
61
- *
62
- * @internal
63
- */
64
- declare const expect$1: LawfulExpectStatic;
65
- type EachFirst = Parameters<typeof V.beforeEach>[0];
66
- type AfterEachFirst = Parameters<typeof V.afterEach>[0];
67
- type BeforeAllFirst = Parameters<typeof V.beforeAll>[0];
68
- type AfterAllFirst = Parameters<typeof V.afterAll>[0];
69
- /**
70
- * @internal
71
- */
72
- declare const beforeEach$1: {
73
- (fn: EachFirst, timeout?: number): void;
74
- (timeout?: number): (fn: EachFirst) => void;
75
- };
76
- /**
77
- * @internal
78
- */
79
- declare const afterEach$1: {
80
- (fn: AfterEachFirst, timeout?: number): void;
81
- (timeout?: number): (fn: AfterEachFirst) => void;
82
- };
83
- /**
84
- * @internal
85
- */
86
- declare const beforeAll$1: {
87
- (fn: BeforeAllFirst, timeout?: number): void;
88
- (timeout?: number): (fn: BeforeAllFirst) => void;
89
- };
90
- /**
91
- * @internal
92
- */
93
- declare const afterAll$1: {
94
- (fn: AfterAllFirst, timeout?: number): void;
95
- (timeout?: number): (fn: AfterAllFirst) => void;
96
- };
97
- declare namespace owned_d_exports {
98
- export { OwnedAssertions, RunBinding, captureRunBinding$1 as captureRunBinding, isOwned, owned$1 as owned, recordAssertion$1 as recordAssertion };
99
- }
100
- /** @internal */
101
- declare const OwnedAssertions: Context.Reference<boolean>;
102
- /** @internal */
103
- declare const isOwned: () => boolean;
104
- /** @internal */
105
- declare const owned$1: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
106
- /**
107
- * Counts an Effect-native check as an assertion of the run it happens in, so the run's own gate sees it.
108
- *
109
- * @internal
110
- */
111
- declare const recordAssertion$1: () => void;
112
- /**
113
- * The test's run binding. `bind` hands it to an effect a library runs on a
114
- * runtime of its own — its own scheduler, a worker, a simulation kernel — so
115
- * the checks inside it count as this test's assertions, report softly, and see
116
- * the same `owned` regions as the test itself.
117
- *
118
- * @internal
119
- */
120
- interface RunBinding {
121
- readonly bind: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
122
- }
123
- /**
124
- * The run binding of the test the caller is executing in.
125
- *
126
- * @internal
127
- */
128
- declare const captureRunBinding$1: Effect.Effect<RunBinding>;
16
+ import * as Scheduler from "effect/Scheduler";
129
17
  //#endregion
130
18
  //#region src/internal/property/defaults.d.ts
131
19
  /** @internal The `test.provide` key the shared config fills with this run's tier's check options. */
@@ -294,36 +182,37 @@ interface VirtualRuntime {
294
182
  readonly end: Effect.Effect<void, never, never>;
295
183
  }
296
184
  declare namespace runner_d_exports {
297
- export { BlockRegistrar, LayerOptions$1 as LayerOptions, NestedLayer, RunEnv, TestContext, addEqualityTesters$1 as addEqualityTesters, describeWrapped$1 as describeWrapped, flakyTest$1 as flakyTest, hookTimeout, layer$1 as layer, makeMethods$1 as makeMethods, perRun, prop$1 as prop, realTime, testEnv, testOptions };
185
+ export { BlockRegistrar, LayerOptions$1 as LayerOptions, NestedLayer, RunEnv, addEqualityTesters$1 as addEqualityTesters, afterEach$1 as afterEach, beforeEach$2 as beforeEach, describeWrapped$1 as describeWrapped, flakyTest$1 as flakyTest, hookTimeout, law$1 as law, layer$1 as layer, makeMethods$1 as makeMethods, perRun, prop$1 as prop, realTime, testEnv, testOptions };
298
186
  }
299
187
  /** @internal */
300
- type TestContext = TestConsole.TestConsole | TestClock.TestClock;
301
- /** @internal */
302
188
  declare const addEqualityTesters$1: () => void;
303
189
  /** @internal */
304
190
  declare const testOptions: (timeout?: number | V.TestOptions) => V.TestOptions;
305
191
  /** @internal */
306
192
  declare const hookTimeout: (timeout?: Duration.Input) => number | undefined;
307
- /**
308
- * How a run arms the step boundary: a test's `stopCheckOf` interrupts it once one of its checks failed (R6),
309
- * and `neverStop` leaves a property's verdict returned, so a `false` one still shrinks (R6, U4).
310
- */
311
- type StopPolicy = (ctx: V.TestContext | undefined) => (() => boolean) | undefined;
312
193
  /** @internal */
313
194
  interface RunEnv {
314
195
  readonly runtime: VirtualRuntime | undefined;
315
196
  readonly owned: boolean;
316
- /** How the runs of this env arm the step boundary. */
317
- readonly stop: StopPolicy;
318
197
  }
319
198
  /** @internal */
320
199
  declare const realTime: RunEnv;
321
- /** @internal */
200
+ /**
201
+ * A run with its own virtual clock: the clock only ever advances when the run's fibers are idle.
202
+ *
203
+ * @internal
204
+ */
322
205
  declare const perRun: () => RunEnv;
323
206
  /** @internal */
324
207
  declare const testEnv: (env: RunEnv) => Layer.Layer<TestConsole.TestConsole, never, never>;
325
208
  /** @internal */
326
- declare const prop$1: Vitest.Methods['prop'];
209
+ declare const prop$1: Vitest.SyncProperty;
210
+ /**
211
+ * The law kinds over the sync property family: the top-level `it.law`.
212
+ *
213
+ * @internal
214
+ */
215
+ declare const law$1: LawApi;
327
216
  /**
328
217
  * Options for the top-level `layer` and for `it.layer` inside a `Methods` block.
329
218
  *
@@ -335,8 +224,8 @@ type LayerOptions$1 = {
335
224
  readonly timeout?: Duration.Input;
336
225
  readonly excludeTestServices?: boolean;
337
226
  /**
338
- * Share one build of these layers across every test of the block, instead of giving each test its own
339
- * fresh build. The only way to share; nested blocks inherit it.
227
+ * Share one build of these layers across every test of the block, instead of giving each test its own fresh
228
+ * build. The only way to share; nested blocks inherit it.
340
229
  */
341
230
  readonly shared?: boolean;
342
231
  };
@@ -367,88 +256,159 @@ declare const flakyTest$1: {
367
256
  <A, E, R>(self: Effect.Effect<A, E, R | Scope.Scope>, timeout?: Duration.Input): Effect.Effect<A, never, R>;
368
257
  (timeout?: Duration.Input): <A, E, R>(self: Effect.Effect<A, E, R | Scope.Scope>) => Effect.Effect<A, never, R>;
369
258
  };
259
+ type EachFirst = Parameters<typeof V.beforeEach>[0];
260
+ type AfterEachFirst = Parameters<typeof V.afterEach>[0];
370
261
  /**
371
- * The fork's `it`: Vitest's test API with the fork's Effect lanes and lawful property lanes attached,
372
- * callable data-first (`it(name, body)`) or data-last (`it(body, options?)(name)`).
262
+ * @internal
263
+ */
264
+ declare const beforeEach$2: {
265
+ (this: HookRefusal, fn: EachFirst, timeout?: number): never;
266
+ (this: HookRefusal, timeout?: number): (fn: EachFirst) => never;
267
+ };
268
+ /**
269
+ * @internal
270
+ */
271
+ declare const afterEach$1: {
272
+ (this: HookRefusal, fn: AfterEachFirst, timeout?: number): never;
273
+ (this: HookRefusal, timeout?: number): (fn: AfterEachFirst) => never;
274
+ };
275
+ /**
276
+ * The fork's `it`: the generator lanes on virtual time, the real-clock lane, the lawful property lanes and the
277
+ * layer blocks, callable data-first (`it(name, body)`) or data-last (`it(body, timeout?)(name)`).
373
278
  *
374
279
  * @internal
375
280
  */
376
281
  declare const makeMethods$1: (it: V.TestAPI) => Vitest.Methods;
377
282
  /** @internal */
378
- /** @internal */
379
- /** @internal */
380
- /** @internal */
381
283
  declare const describeWrapped$1: {
382
284
  (name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
383
285
  (f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
384
286
  };
385
287
  declare namespace mod_d_exports {
386
- export { API, Methods, MethodsNonLive, Vitest, VitestTestContext, addEqualityTesters, afterAll, afterEach, beforeAll, beforeEach, captureRunBinding, describe, describeWrapped, effect, expect, flakyTest, it, layer, live, makeMethods, owned, prop, recordAssertion, vitestTestContextKey };
288
+ export { Asserted, Check, Checks, Expect, Gate, Vitest, VitestTestContext, addEqualityTesters, afterAll, afterEach, assertType, beforeAll, beforeEach, describe, describeWrapped, expectTypeOf, flakyTest, inject, it, law, layer, makeMethods, onTestFailed, onTestFinished, prop, recordArtifact, test, vi, vitest, vitestTestContextKey };
387
289
  }
388
- import * as import_vitest from "vitest";
389
290
  declare module 'vitest' {
390
291
  interface ProvidedContext {
391
292
  [checkDefaultsKey]?: ProvidedCheckDefaults;
392
293
  }
393
294
  }
394
295
  /**
395
- * Vitest's test API, with its call signatures paired: each data-first form has its data-last twin, so
396
- * `it(name, body)`, `it(body)(name)`, `it(name, options, body)` and `it(options, body)(name)` all work.
296
+ * The fork's test API and the types a body, a check and a property are written with.
397
297
  *
398
298
  * @since 4.0.0
399
299
  */
400
- export type API = Omit<V.TestAPI<{}>, never> & {
300
+ export declare namespace Vitest {
401
301
  /**
402
- * Data-last: `it(body, timeout?)(name)`. Declared before the data-first forms so that a bare
403
- * `it(body)` resolves here, which is where the runtime routes a first argument that is not a name.
302
+ * Any argument a refusal accepts. A refusal sits on the `this` type, so the call's own arguments must still
303
+ * type-check; this is the widest argument type this repo's lint allows.
404
304
  *
405
305
  * @since 4.0.0
406
306
  */
407
- <ExtraContext extends {}>(fn?: V.TestFunction<ExtraContext>, options?: number): (name: string | Function) => void;
307
+ type Argument = object | string | number | boolean | bigint | symbol | null | undefined;
408
308
  /**
309
+ * What a body yields and returns: the checks it was handed, then the Effects it yields.
310
+ *
409
311
  * @since 4.0.0
410
312
  */
411
- <ExtraContext extends {}>(name: string | Function, fn: V.TestFunction<ExtraContext> | undefined, options?: number): void;
313
+ type Body<Eff, AEff> = (checks: Checks) => Generator<Eff, AEff, never>;
412
314
  /**
413
- * Data-last: `it(options, body)(name)`.
315
+ * A row body: the row first, then the checks — the order Vitest's `it.for` passes them (R9).
414
316
  *
415
317
  * @since 4.0.0
416
318
  */
417
- <ExtraContext extends {}>(options: V.TestOptions, fn?: V.TestFunction<ExtraContext>): (name: string | Function) => void;
319
+ type RowBody<Row, Eff, AEff> = (row: Row, checks: Checks) => Generator<Eff, AEff, never>;
418
320
  /**
321
+ * Whether `Eff` still stands at the placeholder the checker uses while it is inferring a body's yields.
322
+ * `unknown` is the only sound placeholder; `Sentinel` names it as a generic default, so no bare `unknown`
323
+ * appears at a use site.
324
+ *
419
325
  * @since 4.0.0
420
326
  */
421
- <ExtraContext extends {}>(name: string | Function, options: V.TestOptions, fn?: V.TestFunction<ExtraContext>): void;
422
- };
423
- /**
424
- * @since 4.0.0
425
- */
426
- export declare namespace Vitest {
327
+ type Unresolved<Eff, Sentinel = unknown> = [Eff] extends [never] ? false : [Sentinel] extends [Eff] ? true : false;
427
328
  /**
329
+ * The requirement a body's yields impose on the run.
330
+ *
331
+ * **Details**
332
+ *
333
+ * `Eff` is inferred from what the body yields. While a body is still being inferred — and always, for a body
334
+ * whose `{ expect }` is destructured without an annotation — `Eff` stands at the checker's placeholder, and
335
+ * this reads that placeholder as the checks' own requirement. The body's real yields decide once inference
336
+ * settles, which is what refuses a body that yields no check at the test name (R4).
337
+ *
428
338
  * @since 4.0.0
429
339
  */
430
- interface TestFunction<A, E, R, TestArgs extends TestContextWithValues> {
431
- (...args: TestArgs): Effect.Effect<A, E, R>;
432
- }
340
+ type RequirementOf<Eff> = [Eff] extends [never] ? never : [Eff] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R : Unresolved<Eff> extends true ? Asserted : never;
433
341
  /**
342
+ * What a lane provides besides its block's layer: the scope the body runs in, and the checks it yields.
343
+ *
434
344
  * @since 4.0.0
435
345
  */
436
- type TestContextOnly = [V.TestContext];
346
+ type Lane<R> = R | Scope.Scope | Asserted;
437
347
  /**
348
+ * The no-check gate, on the test name (KTD4). It reads the tuple form so a distributive `Exclude` cannot widen
349
+ * `R`, and it sits on the name rather than the body because a body with a destructured `{ expect }` is
350
+ * context-sensitive: a gate on the body is judged before `{ expect }` is inferred, so it cannot see the checks.
351
+ *
438
352
  * @since 4.0.0
439
353
  */
440
- type TestContextWithValues = [V.TestContext] | [V.TestContext | object] | [V.TestContext | object, V.TestContext] | [V.TestContext | object, V.TestContext & object];
354
+ type Gate<R, Provided = never> = [R] extends [Asserted | Provided] ? [Asserted] extends [R] ? string : NoCheckRefusal : UnprovidedRefusal;
441
355
  /**
356
+ * A body that is not the generator itself, as a parameter union: the error prints the rewrite (KTD3). A sync
357
+ * body, an `async` body and an Effect-returning body each reach one of these texts, at compile time and at run
358
+ * time (R2).
359
+ *
360
+ * @since 4.0.0
361
+ */
362
+ type BodyRefusal = RefuseSyncBody | RefuseAsyncBody | RefuseEffectBody;
363
+ /**
364
+ * A test lane: `it(name, function* ({ expect }) { ... })`. `R` is what the lane's own environment provides
365
+ * besides the checks — its scope, and the services of the `layer` block it is written in.
366
+ *
442
367
  * @since 4.0.0
443
368
  */
444
369
  interface Test<R> {
445
- <A, E>(name: string, self: TestFunction<A, E, R, [V.TestContext]>, timeout?: number | V.TestOptions): void;
446
- /**
447
- * Data-last: `it.effect(self, timeout?)(name)`.
448
- *
449
- * @since 4.0.0
450
- */
451
- <A, E>(self: TestFunction<A, E, R, [V.TestContext]>, timeout?: number | V.TestOptions): (name: string) => void;
370
+ <Eff, AEff>(name: NoInfer<Gate<RequirementOf<Eff>, Lane<R>>>, body: Body<Eff, AEff> | BodyRefusal, timeout?: number | V.TestOptions): void;
371
+ <Eff, AEff>(body: Body<Eff, AEff> | BodyRefusal, timeout?: number | V.TestOptions): (name: NoInfer<Gate<RequirementOf<Eff>, Lane<R>>>) => void;
372
+ }
373
+ /**
374
+ * A row lane: `it.each(rows)(name, function* (row, { expect }) { ... })`.
375
+ *
376
+ * @since 4.0.0
377
+ */
378
+ interface RowTest<Row, R> {
379
+ <Eff, AEff>(name: NoInfer<Gate<RequirementOf<Eff>, Lane<R>>>, body: RowBody<Row, Eff, AEff> | BodyRefusal, timeout?: number | V.TestOptions): void;
380
+ }
381
+ /**
382
+ * The `it` modifiers every lane has, each registering the same generator body.
383
+ *
384
+ * @since 4.0.0
385
+ */
386
+ interface Modifiers<R> {
387
+ readonly skip: Test<R>;
388
+ readonly skipIf: (condition: boolean) => Test<R>;
389
+ readonly runIf: (condition: boolean) => Test<R>;
390
+ readonly only: Test<R>;
391
+ readonly fails: Test<R>;
392
+ readonly each: <Row>(cases: ReadonlyArray<Row>) => RowTest<Row, R>;
393
+ }
394
+ /**
395
+ * A lane with the Effect-lane property attached: `it.live.prop(...)` and `it.effect.prop(...)`.
396
+ *
397
+ * @since 4.0.0
398
+ */
399
+ interface Tester<R> extends Test<R>, Modifiers<R> {
400
+ readonly prop: EffectProperty<R>;
401
+ }
402
+ /**
403
+ * A removed habit lane: calling it is a `this`-type error naming the lane and its rewrite, and a run-time
404
+ * throw with the same text (R9, KTD3). `Refusal` is that lane's own text, so `it.scoped` blames `it.scoped`
405
+ * and `it.effect` blames `it.effect`. It keeps `prop`, so `it.effect.prop` still runs properties.
406
+ *
407
+ * @since 4.0.0
408
+ */
409
+ interface EffectLane<R, Refusal extends string = EffectLaneRefusal> {
410
+ (this: Refusal, ...args: ReadonlyArray<Argument>): never;
411
+ readonly prop: EffectProperty<R | Scope.Scope>;
452
412
  }
453
413
  /**
454
414
  * A generated input: a Schema, or an Arbitrary of an already-generated type.
@@ -482,6 +442,21 @@ export declare namespace Vitest {
482
442
  * @since 4.0.0
483
443
  */
484
444
  type PropertySpec<G extends Gens, S extends PropertySubject, N extends number> = PropertySpec$1<G, S, N>;
445
+ /**
446
+ * A property's `holds` on the Effect lane: the verdict is an `Effect` of the literal boolean.
447
+ *
448
+ * @since 4.0.0
449
+ */
450
+ type EffectProperty<R> = <const G extends Gens, S extends PropertySubject, N extends number, E>(name: string, spec: PropertySpec<G, S, N>, holds: (subject: S, values: Values<G>) => Effect.Effect<boolean, E, R>) => void;
451
+ /**
452
+ * A property's `holds` on the sync lane: the verdict is a literal boolean.
453
+ *
454
+ * @since 4.0.0
455
+ */
456
+ type SyncProperty = {
457
+ <const G extends Gens, S extends PropertySubject, N extends number>(name: string, spec: PropertySpec<G, S, N>, holds: (subject: S, values: Values<G>) => boolean): void;
458
+ <const G extends Gens, S extends PropertySubject, N extends number>(spec: PropertySpec<G, S, N>, holds: (subject: S, values: Values<G>) => boolean): (name: string) => void;
459
+ };
485
460
  /**
486
461
  * The block a layer opens: `layer(L)(body)` or `layer(L)("name", body)`.
487
462
  *
@@ -516,39 +491,16 @@ export declare namespace Vitest {
516
491
  */
517
492
  type FlakyTest = typeof flakyTest$1;
518
493
  /**
494
+ * The lanes a `layer` block hands its body: the generator lanes, the fences a property lives in, and the
495
+ * removal of the Effect lane as a callable. `R` is what the block's layer provides; the lanes carry the
496
+ * block's own scope beside it, which is why the base callable is `Test<R | Scope.Scope>`.
497
+ *
519
498
  * @since 4.0.0
520
499
  */
521
- interface Tester<R> extends Vitest.Test<R> {
522
- skip: Vitest.Test<R>;
523
- skipIf: (condition: boolean) => Vitest.Test<R>;
524
- runIf: (condition: boolean) => Vitest.Test<R>;
525
- only: Vitest.Test<R>;
526
- each: <T extends object>(cases: ReadonlyArray<T>) => <A, E>(name: string, self: TestFunction<A, E, R, TestContextWithValues & [V.TestContext | T]>, timeout?: number | V.TestOptions) => void;
527
- fails: Vitest.Test<R>;
528
- /**
529
- * Runs a property that names its subject and carries a budget, on the Effect lane.
530
- *
531
- * **Details**
532
- *
533
- * `spec.subject` is handed to `holds` instead of being imported into the property. `holds` returns an
534
- * `Effect` of its verdict: `true` holds, `false` falsifies and triggers shrinking, and any typed failure
535
- * falsifies the property with its cause. A verdict that is not a literal boolean fails as
536
- * `NonBooleanVerdict`; a `runs` that is not a positive integer fails as `InvalidBudget`. `runs` is optional:
537
- * the property's own fields win over the configured default (`test.provide`) over `runs: 100`. After the
538
- * property holds, it is run again against a constant impostor of its subject; the file fails as
539
- * `VacuousProperty` unless some property in it refutes that impostor.
540
- *
541
- * The old positional form `it.effect.prop(name, [arbitraries], predicate)` is refused.
542
- *
543
- * @since 4.0.0
544
- */
545
- prop: <const G extends Gens, S extends PropertySubject, N extends number, E>(name: string, spec: PropertySpec<G, S, N>, holds: (subject: S, values: Values<G>) => Effect.Effect<boolean, E, R>) => void;
546
- }
547
- /**
548
- * @since 4.0.0
549
- */
550
- interface MethodsNonLive<R = never> extends API {
551
- readonly effect: Vitest.Tester<R | Scope.Scope>;
500
+ interface MethodsNonLive<R = never> extends Test<R | Scope.Scope>, Modifiers<R | Scope.Scope> {
501
+ readonly effect: EffectLane<R, EffectLaneRefusal>;
502
+ readonly scoped: EffectLane<R, ScopedLaneRefusal>;
503
+ readonly scopedLive: EffectLane<R, ScopedLiveLaneRefusal>;
552
504
  readonly flakyTest: FlakyTest;
553
505
  readonly layer: LayerOf<R, NestedLayerOptions>;
554
506
  /**
@@ -567,10 +519,7 @@ export declare namespace Vitest {
567
519
  *
568
520
  * @since 4.0.0
569
521
  */
570
- readonly prop: {
571
- <const G extends Gens, S extends PropertySubject, N extends number>(name: string, spec: PropertySpec<G, S, N>, holds: (subject: S, values: Values<G>) => boolean): void;
572
- <const G extends Gens, S extends PropertySubject, N extends number>(spec: PropertySpec<G, S, N>, holds: (subject: S, values: Values<G>) => boolean): (name: string) => void;
573
- };
522
+ readonly prop: SyncProperty;
574
523
  /**
575
524
  * The R13 law kinds: `model`, `metamorphic`, `roundTrip` and `invariant` are gated like `prop`;
576
525
  * `idempotent` and `deterministic` skip the impostor gate and are reported as exempt.
@@ -580,76 +529,66 @@ export declare namespace Vitest {
580
529
  readonly law: LawApi;
581
530
  }
582
531
  /**
532
+ * The top-level methods: `MethodsNonLive` plus the real-clock lane and the top-level `layer`.
533
+ *
583
534
  * @since 4.0.0
584
535
  */
585
536
  interface Methods<R = never> extends MethodsNonLive<R> {
586
- readonly live: Vitest.Tester<Scope.Scope | R>;
537
+ readonly live: Tester<R | Scope.Scope>;
587
538
  readonly layer: LayerOf<R, LayerOptions>;
588
539
  }
589
540
  }
590
541
  /**
542
+ * The fork's test API, with the generator lanes of R2 and R9.
543
+ *
591
544
  * @since 4.0.0
592
545
  */
593
- export type MethodsNonLive<R = never> = Vitest.MethodsNonLive<R>;
594
- /**
595
- * @since 4.0.0
596
- */
597
- export type Methods<R = never> = Vitest.Methods<R>;
546
+ export declare const it: Vitest.Methods;
598
547
  /**
548
+ * The same lanes under the other name upstream publishes.
549
+ *
599
550
  * @since 4.0.0
600
551
  */
601
- export declare const addEqualityTesters: () => void;
552
+ export declare const test: Vitest.Methods;
602
553
  /**
554
+ * The fork's lawful collector: it forces the fork's concurrency and shuffle defaults and hands its body the
555
+ * fork's methods.
556
+ *
603
557
  * @since 4.0.0
604
558
  */
605
- export declare const effect: Vitest.Tester<Scope.Scope>;
559
+ export declare const describeWrapped: {
560
+ (name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
561
+ (f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
562
+ };
606
563
  /**
607
564
  * @since 4.0.0
608
565
  */
609
- export declare const live: Vitest.Tester<Scope.Scope>;
566
+ export declare const describe: {
567
+ (name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
568
+ (f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
569
+ };
610
570
  /**
611
- * Share a `Layer` between multiple tests, optionally wrapping
612
- * the tests in a `describe` block if a name is provided.
613
- *
614
- * Named layers accept `concurrent` to override inherited suite concurrency.
615
- * Anonymous layers always inherit the enclosing suite's concurrency.
616
- * Use `ctx.expect` in concurrent tests for test-local snapshots and assertion counts.
617
- *
618
- * @since 4.0.0
571
+ * Share a `Layer` between multiple tests, optionally wrapping the tests in a `describe` block if a name is
572
+ * provided. Every test in the block gets its own fresh build of the layer, unless the block declares
573
+ * `shared: true`.
619
574
  *
620
575
  * ```ts
621
- * import { assert, layer } from "@systemfsoftware/vitest"
622
- * import { Effect, Layer, Context } from "effect"
576
+ * import { it, layer } from "@systemfsoftware/vitest"
577
+ * import { Context, Effect, Layer } from "effect"
623
578
  *
624
579
  * class Foo extends Context.Service<Foo, "foo">()("Foo") {
625
580
  * static layer = Layer.succeed(Foo, "foo")
626
581
  * }
627
582
  *
628
- * class Bar extends Context.Service<Bar, "bar">()("Bar") {
629
- * static layer = Layer.effect(
630
- * Bar,
631
- * Effect.map(Foo, () => "bar" as const)
632
- * )
633
- * }
634
- *
635
583
  * layer(Foo.layer)("layer", (it) => {
636
- * it.effect("adds context", () =>
637
- * Effect.gen(function*() {
638
- * const foo = yield* Foo
639
- * assert.strictEqual(foo, "foo")
640
- * }))
641
- *
642
- * it.layer(Bar.layer)("nested", (it) => {
643
- * it.effect("adds context", () =>
644
- * Effect.gen(function*() {
645
- * const foo = yield* Foo
646
- * const bar = yield* Bar
647
- * assert.strictEqual(foo, "foo")
648
- * assert.strictEqual(bar, "bar")
649
- * }))
584
+ * it("reads the service", function* ({ expect }) {
585
+ * const foo = yield* Foo
586
+ * yield* expect(foo).toEqual("foo")
650
587
  * })
651
588
  * })
652
589
  * ```
590
+ *
591
+ * @since 4.0.0
653
592
  */
654
593
  export declare const layer: Vitest.LayerOf<never, Vitest.LayerOptions>;
655
594
  /**
@@ -659,77 +598,52 @@ export declare const flakyTest: Vitest.FlakyTest;
659
598
  /**
660
599
  * @since 4.0.0
661
600
  */
662
- export declare const prop: Vitest.Methods['prop'];
601
+ export declare const prop: Vitest.SyncProperty;
663
602
  /**
664
603
  * @since 4.0.0
665
604
  */
666
- export declare const owned: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
605
+ export declare const law: LawApi;
667
606
  /**
668
- * @since 4.0.0
669
- */
670
- export declare const recordAssertion: () => void;
671
- /**
672
- * The run binding of the test the effect is executing in. `bind` re-provides it
673
- * to an effect a library runs on a runtime of its own — its own scheduler, a
674
- * worker, a simulation kernel — so the checks inside it count as this test's
675
- * assertions, report softly, and see the same `owned` regions as the test.
607
+ * The fork's test API over another Vitest `it`, so a library can register tests in its own suite.
676
608
  *
677
609
  * @since 4.0.0
678
610
  */
679
- export declare const captureRunBinding: Effect.Effect<RunBinding>;
611
+ export declare const makeMethods: (it: V.TestAPI) => Vitest.Methods;
680
612
  /**
681
- * The key the running test's context is published under. A library that carries its own view of the task
682
- * context builds that view on this key, so the context a case lane sees and a property lane sees agree.
613
+ * Refused: hooks share state between tests, and services come fresh per test from `layer`.
683
614
  *
684
615
  * @since 4.0.0
685
616
  */
686
- export declare const vitestTestContextKey: string;
617
+ export declare const beforeEach: typeof beforeEach$2;
687
618
  /**
688
- * The running Vitest `TestContext`, provided on every test the fork runs — the Effect lanes, both property
689
- * lanes, and each `it.each` row. It is `null` outside a run.
619
+ * Refused: hooks share state between tests, and services come fresh per test from `layer`.
690
620
  *
691
621
  * @since 4.0.0
692
622
  */
693
- export declare const VitestTestContext: Context.Reference<V.TestContext | null>;
694
- /**
695
- * @since 4.0.0
696
- */
697
- export declare const it: Vitest.Methods;
698
- /**
699
- * @since 4.0.0
700
- */
701
- export declare const makeMethods: (it: V.TestAPI) => Vitest.Methods;
623
+ export declare const afterEach: typeof afterEach$1;
702
624
  /**
703
625
  * @since 4.0.0
704
626
  */
705
- export declare const describeWrapped: {
706
- (name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
707
- (f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
708
- };
709
- export declare const describe: {
710
- (name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
711
- (f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
712
- };
627
+ export declare const addEqualityTesters: () => void;
713
628
  /**
714
- * The fork's `expect`: soft within one Effect step, refusing the slop forms.
629
+ * The key the running test's context is published under. A library that carries its own view of the task
630
+ * context builds that view on this key, so the context a case lane sees and a property lane sees agree.
715
631
  *
716
632
  * @since 4.0.0
717
633
  */
718
- export declare const expect: typeof expect$1;
719
- /**
720
- * @since 4.0.0
721
- */
722
- export declare const beforeEach: typeof beforeEach$1;
723
- /**
724
- * @since 4.0.0
725
- */
726
- export declare const afterEach: typeof afterEach$1;
634
+ export declare const vitestTestContextKey: string;
727
635
  /**
636
+ * The running Vitest `TestContext`, provided on every test the fork runs — every generator lane, both property
637
+ * lanes, and each `it.each` row. It is `null` outside a run.
638
+ *
728
639
  * @since 4.0.0
729
640
  */
730
- export declare const beforeAll: typeof beforeAll$1;
641
+ export declare const VitestTestContext: Context.Reference<V.TestContext | null>;
731
642
  /**
643
+ * The no-check gate, on the test name (KTD4).
644
+ *
732
645
  * @since 4.0.0
733
646
  */
734
- export declare const afterAll: typeof afterAll$1;
735
- //#endregion
647
+ export type Gate<R, Provided = never> = Vitest.Gate<R, Provided>;
648
+ //#endregion
649
+ export { type Asserted, type Check, type Checks, type Expect, afterAll, assertType, beforeAll, expectTypeOf, inject, onTestFailed, onTestFinished, recordArtifact, vi, vitest };