@systemfsoftware/vitest 0.0.0 → 0.2.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/CHANGELOG.md +24 -0
- package/README.md +113 -61
- package/dist/TestClock.d.ts +1 -1
- package/dist/checks-Cq9of-Lx.d.ts +336 -0
- package/dist/engine-YsoQ_9we.d.ts +158 -0
- package/dist/failure-BquJJPFZ.mjs +1217 -0
- package/dist/failure.d.ts +80 -0
- package/dist/failure.mjs +4 -0
- package/dist/guard-p_8ARgPm.mjs +250 -0
- package/dist/guard.d.ts +2 -0
- package/dist/guard.mjs +19 -0
- package/dist/index.d.ts +203 -440
- package/dist/index.mjs +376 -1055
- package/dist/integration.d.ts +37 -0
- package/dist/integration.mjs +38 -0
- package/dist/test-context-ChvjVyCo.mjs +328 -0
- package/package.json +17 -12
- package/dist/refusals-BQtDszyU.mjs +0 -32
- package/dist/refusals-_6e3GzVK.d.ts +0 -37
- package/dist/refusals.d.ts +0 -3
- package/dist/refusals.mjs +0 -3
- package/dist/utils.d.ts +0 -197
- package/dist/utils.mjs +0 -227
package/dist/index.d.ts
CHANGED
|
@@ -1,288 +1,23 @@
|
|
|
1
1
|
/// <reference types="./compat.d.ts" />
|
|
2
|
-
import { n as
|
|
2
|
+
import { a as Values$1, c as kinds_d_exports, i as PropertySubject$1, l as __exportAll, n as Gens$1, o as engine_d_exports, r as PropertySpec$1, s as LawApi, t as ArbitraryInput } from "./engine-YsoQ_9we.js";
|
|
3
|
+
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-Cq9of-Lx.js";
|
|
3
4
|
import * as V from "vitest";
|
|
4
|
-
import
|
|
5
|
-
import { Schema } from "effect";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Cause from "effect/Cause";
|
|
5
|
+
import { afterAll, assertType, beforeAll, expectTypeOf, inject, onTestFailed, onTestFinished, recordArtifact, vi, vitest } from "vitest";
|
|
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
|
-
import * as Schema$1 from "effect/Schema";
|
|
12
9
|
import * as Scope from "effect/Scope";
|
|
13
|
-
import * as TestClock from "effect/testing/TestClock";
|
|
14
10
|
import * as TestConsole from "effect/testing/TestConsole";
|
|
11
|
+
import * as Context from "effect/Context";
|
|
15
12
|
import * as Arbitrary from "effect/unstable/arbitrary/Arbitrary";
|
|
16
13
|
import * as Clock from "effect/Clock";
|
|
17
|
-
|
|
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>;
|
|
129
|
-
//#endregion
|
|
14
|
+
import * as Scheduler from "effect/Scheduler";
|
|
130
15
|
//#region src/internal/property/defaults.d.ts
|
|
131
16
|
/** @internal The `test.provide` key the shared config fills with this run's tier's check options. */
|
|
132
17
|
declare const checkDefaultsKey = "@systemfsoftware/vitest:property-check";
|
|
133
18
|
/** @internal The check options a run supplies as its property default, minus `replay`. */
|
|
134
19
|
type ProvidedCheckDefaults = Omit<Arbitrary.CheckOptions, 'replay'>;
|
|
135
20
|
//#endregion
|
|
136
|
-
//#region src/internal/errors.schema.d.ts
|
|
137
|
-
declare const NonBooleanVerdict_base: Schema.Class<NonBooleanVerdict, Schema.TaggedStruct<"NonBooleanVerdict", {
|
|
138
|
-
readonly detail: Schema.String;
|
|
139
|
-
}>, import("effect/Cause").YieldableError>;
|
|
140
|
-
/** @internal */
|
|
141
|
-
declare class NonBooleanVerdict extends NonBooleanVerdict_base {
|
|
142
|
-
get message(): string;
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/internal/property/impostor.d.ts
|
|
146
|
-
/**
|
|
147
|
-
* @internal The constant impostor of R12: a fake of the subject under test that
|
|
148
|
-
* returns the first output it ever produced, for every later call, whatever the
|
|
149
|
-
* input it was given.
|
|
150
|
-
*
|
|
151
|
-
* A property that still holds for the impostor does not constrain the subject.
|
|
152
|
-
* Whether that is fatal is a per-file question — a subject's impostor must be
|
|
153
|
-
* refuted by some property in its file — so this module builds the fake and
|
|
154
|
-
* collects the verdicts; the engine decides them once, when the file finishes
|
|
155
|
-
* (KTD10).
|
|
156
|
-
*/
|
|
157
|
-
/**
|
|
158
|
-
* A value the fork hands over without inspecting: an argument to the subject, or one of its outputs.
|
|
159
|
-
*
|
|
160
|
-
* @internal
|
|
161
|
-
*/
|
|
162
|
-
type Opaque<A = unknown> = A;
|
|
163
|
-
/**
|
|
164
|
-
* A function under test: any argument, any output.
|
|
165
|
-
*
|
|
166
|
-
* @internal
|
|
167
|
-
*/
|
|
168
|
-
type SubjectFunction = (...values: ReadonlyArray<never>) => Opaque;
|
|
169
|
-
/**
|
|
170
|
-
* A record of functions under test; every member is replaced by a constant.
|
|
171
|
-
*
|
|
172
|
-
* @internal
|
|
173
|
-
*/
|
|
174
|
-
type MemberRecord = {
|
|
175
|
-
readonly [key: string]: SubjectFunction;
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* The function under test, or a record of them.
|
|
179
|
-
*
|
|
180
|
-
* @internal
|
|
181
|
-
*/
|
|
182
|
-
type Subject = SubjectFunction | MemberRecord;
|
|
183
|
-
declare namespace kinds_d_exports {
|
|
184
|
-
export { LawApi, LawKind, LawSubject, MetamorphicRelation, deterministicHolds, idempotentHolds, invariantHolds, metamorphicHolds, modelHolds, roundTripHolds, spreadValues };
|
|
185
|
-
}
|
|
186
|
-
/** @internal */
|
|
187
|
-
type LawKind = 'model' | 'metamorphic' | 'roundTrip' | 'invariant' | 'idempotent' | 'deterministic';
|
|
188
|
-
/**
|
|
189
|
-
* A subject of a law kind: a function of the generated values.
|
|
190
|
-
*
|
|
191
|
-
* @internal
|
|
192
|
-
*/
|
|
193
|
-
type LawSubject<G extends Gens$1, A> = (...values: ReadonlyArray<ElementValues<G>>) => A;
|
|
194
|
-
/**
|
|
195
|
-
* A metamorphic relation: the input transform, and how the two outputs relate (structural equality by default).
|
|
196
|
-
*
|
|
197
|
-
* @internal
|
|
198
|
-
*/
|
|
199
|
-
interface MetamorphicRelation<G extends Gens$1, A> {
|
|
200
|
-
readonly transform: (...values: ReadonlyArray<ElementValues<G>>) => Values$1<G>;
|
|
201
|
-
readonly relate?: (original: A, transformed: A) => boolean;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* The R13 law surface: four gated kinds and two declared exemptions.
|
|
205
|
-
*
|
|
206
|
-
* @internal
|
|
207
|
-
*/
|
|
208
|
-
interface LawApi {
|
|
209
|
-
readonly model: <const G extends Gens$1, A, N extends number, S extends LawSubject<G, A>>(name: string, spec: PropertySpec$1<G, S, N>, oracle: LawSubject<G, A>) => void;
|
|
210
|
-
readonly metamorphic: <const G extends Gens$1, A, N extends number, S extends LawSubject<G, A>>(name: string, spec: PropertySpec$1<G, S, N>, relation: MetamorphicRelation<G, A>) => void;
|
|
211
|
-
readonly roundTrip: <const G extends Gens$1, E, N extends number, S extends LawSubject<G, E>>(name: string, spec: PropertySpec$1<G, S, N>, decode: (encoded: E) => Values$1<G>) => void;
|
|
212
|
-
readonly invariant: <const G extends Gens$1, A, N extends number, S extends LawSubject<G, A>>(name: string, spec: PropertySpec$1<G, S, N>, holds: (output: A, ...values: ReadonlyArray<ElementValues<G>>) => boolean) => void;
|
|
213
|
-
readonly idempotent: <const G extends Gens$1, N extends number, S extends (value: ElementValues<G>) => ElementValues<G>>(name: string, spec: PropertySpec$1<G, S, N>) => void;
|
|
214
|
-
readonly deterministic: <const G extends Gens$1, A, N extends number, S extends LawSubject<G, A>>(name: string, spec: PropertySpec$1<G, S, N>) => void;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* The generated values as the argument list a law subject is called with.
|
|
218
|
-
*
|
|
219
|
-
* @internal
|
|
220
|
-
*/
|
|
221
|
-
declare const spreadValues: <G extends Gens$1>(values: Values$1<G>) => ReadonlyArray<ElementValues<G>>;
|
|
222
|
-
/** @internal */
|
|
223
|
-
declare const modelHolds: <G extends Gens$1, A>(oracle: LawSubject<G, A>) => (subject: LawSubject<G, A>, values: Values$1<G>) => boolean;
|
|
224
|
-
/** @internal */
|
|
225
|
-
declare const metamorphicHolds: <G extends Gens$1, A>(relation: MetamorphicRelation<G, A>) => (subject: LawSubject<G, A>, values: Values$1<G>) => boolean;
|
|
226
|
-
/** @internal */
|
|
227
|
-
declare const roundTripHolds: <G extends Gens$1, E>(decode: (encoded: E) => Values$1<G>) => (subject: LawSubject<G, E>, values: Values$1<G>) => boolean;
|
|
228
|
-
/** @internal */
|
|
229
|
-
declare const invariantHolds: <G extends Gens$1, A>(holds: (output: A, ...values: ReadonlyArray<ElementValues<G>>) => boolean) => (subject: LawSubject<G, A>, values: Values$1<G>) => boolean;
|
|
230
|
-
/** @internal */
|
|
231
|
-
declare const idempotentHolds: <G extends Gens$1>() => (subject: (value: ElementValues<G>) => ElementValues<G>, values: Values$1<G>) => boolean;
|
|
232
|
-
/** @internal */
|
|
233
|
-
declare const deterministicHolds: <G extends Gens$1, A>() => (subject: LawSubject<G, A>, values: Values$1<G>) => boolean;
|
|
234
|
-
declare namespace engine_d_exports {
|
|
235
|
-
export { ArbitraryInput, CoveragePredicate, ElementValues, Gens$1 as Gens, PropApi, PropertyRuntime, PropertySpec$1 as PropertySpec, PropertySubject$1 as PropertySubject, Values$1 as Values, makeProperty };
|
|
236
|
-
}
|
|
237
|
-
/** @internal */
|
|
238
|
-
type ArbitraryInput = Schema$1.Top | Arbitrary.Arbitrary<Schema$1.Top['Type']>;
|
|
239
|
-
/** @internal */
|
|
240
|
-
type Gens$1 = ReadonlyArray<ArbitraryInput> | {
|
|
241
|
-
readonly [key: string]: ArbitraryInput;
|
|
242
|
-
};
|
|
243
|
-
type Generated<I> = I extends Schema$1.Schema<infer T> ? T : I extends Arbitrary.Arbitrary<infer A> ? A : never;
|
|
244
|
-
/** @internal */
|
|
245
|
-
type Values$1<G extends Gens$1> = { readonly [K in keyof G]: Generated<G[K]>; };
|
|
246
|
-
/** @internal */
|
|
247
|
-
type ElementValues<G extends Gens$1> = G extends ReadonlyArray<ArbitraryInput> ? Generated<G[number]> : never;
|
|
248
|
-
/** @internal */
|
|
249
|
-
type PropertySubject$1 = Subject;
|
|
250
|
-
/** @internal */
|
|
251
|
-
type CoveragePredicate<G extends Gens$1> = (...values: ReadonlyArray<ElementValues<G>>) => boolean;
|
|
252
|
-
type PropertyRuns<N extends number> = number extends N ? number : `${N}` extends `-${bigint}` ? never : `${N}` extends `${bigint}` ? (N extends 0 ? never : N) : never;
|
|
253
|
-
/** @internal */
|
|
254
|
-
interface PropertySpec$1<G extends Gens$1, S extends PropertySubject$1, N extends number> {
|
|
255
|
-
readonly of: G;
|
|
256
|
-
readonly subject: S;
|
|
257
|
-
/**
|
|
258
|
-
* The property's own run count. Omitted, the configured default applies; when the run provides none,
|
|
259
|
-
* the built-in default of 100 does.
|
|
260
|
-
*/
|
|
261
|
-
readonly runs?: N & PropertyRuns<N>;
|
|
262
|
-
/** Labelled input predicates, each with the minimum share of runs it must see (R14). */
|
|
263
|
-
readonly cover?: Readonly<Record<string, readonly [CoveragePredicate<G>, number]>>;
|
|
264
|
-
/** The property's own check options, merged field by field over the provided and built-in defaults. */
|
|
265
|
-
readonly arbitrary?: Arbitrary.CheckOptions;
|
|
266
|
-
}
|
|
267
|
-
/** @internal */
|
|
268
|
-
interface PropertyRuntime<R> {
|
|
269
|
-
/** Registers the property's program; the runtime runs it inside the test it registers, under that test's binding. */
|
|
270
|
-
readonly register: (name: string, program: () => Effect.Effect<void, Cause.Cause<NonBooleanVerdict>, never>) => void;
|
|
271
|
-
readonly provide: <A, E>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, never>;
|
|
272
|
-
}
|
|
273
|
-
/** @internal */
|
|
274
|
-
interface PropApi<R> {
|
|
275
|
-
readonly prop: <const G extends Gens$1, S extends PropertySubject$1, N extends number>(name: string, spec: PropertySpec$1<G, S, N>, holds: (subject: S, values: Values$1<G>) => boolean) => void;
|
|
276
|
-
readonly effectProp: <const G extends Gens$1, S extends PropertySubject$1, N extends number, E>(name: string, spec: PropertySpec$1<G, S, N>, holds: (subject: S, values: Values$1<G>) => Effect.Effect<boolean, E, R>) => void;
|
|
277
|
-
readonly law: LawApi;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* The property surface over one runtime: `prop`, `effectProp`, and the R13 law kinds routed through the gate.
|
|
281
|
-
*
|
|
282
|
-
* @internal
|
|
283
|
-
*/
|
|
284
|
-
declare const makeProperty: <R>(runtime: PropertyRuntime<R>) => PropApi<R>;
|
|
285
|
-
//#endregion
|
|
286
21
|
//#region src/internal/virtual-time.d.ts
|
|
287
22
|
/** @internal */
|
|
288
23
|
interface VirtualRuntime {
|
|
@@ -294,36 +29,37 @@ interface VirtualRuntime {
|
|
|
294
29
|
readonly end: Effect.Effect<void, never, never>;
|
|
295
30
|
}
|
|
296
31
|
declare namespace runner_d_exports {
|
|
297
|
-
export { BlockRegistrar, LayerOptions$1 as LayerOptions, NestedLayer, RunEnv,
|
|
32
|
+
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
33
|
}
|
|
299
34
|
/** @internal */
|
|
300
|
-
type TestContext = TestConsole.TestConsole | TestClock.TestClock;
|
|
301
|
-
/** @internal */
|
|
302
35
|
declare const addEqualityTesters$1: () => void;
|
|
303
36
|
/** @internal */
|
|
304
37
|
declare const testOptions: (timeout?: number | V.TestOptions) => V.TestOptions;
|
|
305
38
|
/** @internal */
|
|
306
39
|
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
40
|
/** @internal */
|
|
313
41
|
interface RunEnv {
|
|
314
42
|
readonly runtime: VirtualRuntime | undefined;
|
|
315
43
|
readonly owned: boolean;
|
|
316
|
-
/** How the runs of this env arm the step boundary. */
|
|
317
|
-
readonly stop: StopPolicy;
|
|
318
44
|
}
|
|
319
45
|
/** @internal */
|
|
320
46
|
declare const realTime: RunEnv;
|
|
321
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* A run with its own virtual clock: the clock only ever advances when the run's fibers are idle.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
322
52
|
declare const perRun: () => RunEnv;
|
|
323
53
|
/** @internal */
|
|
324
54
|
declare const testEnv: (env: RunEnv) => Layer.Layer<TestConsole.TestConsole, never, never>;
|
|
325
55
|
/** @internal */
|
|
326
|
-
declare const prop$1: Vitest.
|
|
56
|
+
declare const prop$1: Vitest.SyncProperty;
|
|
57
|
+
/**
|
|
58
|
+
* The law kinds over the sync property family: the top-level `it.law`.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
declare const law$1: LawApi;
|
|
327
63
|
/**
|
|
328
64
|
* Options for the top-level `layer` and for `it.layer` inside a `Methods` block.
|
|
329
65
|
*
|
|
@@ -335,8 +71,8 @@ type LayerOptions$1 = {
|
|
|
335
71
|
readonly timeout?: Duration.Input;
|
|
336
72
|
readonly excludeTestServices?: boolean;
|
|
337
73
|
/**
|
|
338
|
-
* Share one build of these layers across every test of the block, instead of giving each test its own
|
|
339
|
-
*
|
|
74
|
+
* Share one build of these layers across every test of the block, instead of giving each test its own fresh
|
|
75
|
+
* build. The only way to share; nested blocks inherit it.
|
|
340
76
|
*/
|
|
341
77
|
readonly shared?: boolean;
|
|
342
78
|
};
|
|
@@ -367,88 +103,161 @@ declare const flakyTest$1: {
|
|
|
367
103
|
<A, E, R>(self: Effect.Effect<A, E, R | Scope.Scope>, timeout?: Duration.Input): Effect.Effect<A, never, R>;
|
|
368
104
|
(timeout?: Duration.Input): <A, E, R>(self: Effect.Effect<A, E, R | Scope.Scope>) => Effect.Effect<A, never, R>;
|
|
369
105
|
};
|
|
106
|
+
type EachFirst = Parameters<typeof V.beforeEach>[0];
|
|
107
|
+
type AfterEachFirst = Parameters<typeof V.afterEach>[0];
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
declare const beforeEach$2: {
|
|
112
|
+
(this: HookRefusal, fn: EachFirst, timeout?: number): never;
|
|
113
|
+
(this: HookRefusal, timeout?: number): (fn: EachFirst) => never;
|
|
114
|
+
};
|
|
370
115
|
/**
|
|
371
|
-
*
|
|
372
|
-
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
declare const afterEach$1: {
|
|
119
|
+
(this: HookRefusal, fn: AfterEachFirst, timeout?: number): never;
|
|
120
|
+
(this: HookRefusal, timeout?: number): (fn: AfterEachFirst) => never;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* The fork's `it`: the generator lanes on virtual time, the real-clock lane, the lawful property lanes and the
|
|
124
|
+
* layer blocks, callable data-first (`it(name, body)`) or data-last (`it(body, timeout?)(name)`).
|
|
373
125
|
*
|
|
374
126
|
* @internal
|
|
375
127
|
*/
|
|
376
128
|
declare const makeMethods$1: (it: V.TestAPI) => Vitest.Methods;
|
|
377
129
|
/** @internal */
|
|
378
|
-
/** @internal */
|
|
379
|
-
/** @internal */
|
|
380
|
-
/** @internal */
|
|
381
130
|
declare const describeWrapped$1: {
|
|
382
131
|
(name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
|
|
383
132
|
(f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
|
|
384
133
|
};
|
|
385
134
|
declare namespace mod_d_exports {
|
|
386
|
-
export {
|
|
135
|
+
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
136
|
}
|
|
388
|
-
import * as import_vitest from "vitest";
|
|
389
137
|
declare module 'vitest' {
|
|
390
138
|
interface ProvidedContext {
|
|
391
139
|
[checkDefaultsKey]?: ProvidedCheckDefaults;
|
|
140
|
+
'@systemfsoftware/vitest:package'?: string;
|
|
141
|
+
'@systemfsoftware/vitest:workspace-root'?: string;
|
|
392
142
|
}
|
|
393
143
|
}
|
|
394
144
|
/**
|
|
395
|
-
*
|
|
396
|
-
* `it(name, body)`, `it(body)(name)`, `it(name, options, body)` and `it(options, body)(name)` all work.
|
|
145
|
+
* The fork's test API and the types a body, a check and a property are written with.
|
|
397
146
|
*
|
|
398
147
|
* @since 4.0.0
|
|
399
148
|
*/
|
|
400
|
-
export
|
|
149
|
+
export declare namespace Vitest {
|
|
401
150
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
151
|
+
* Any argument a refusal accepts. A refusal sits on the `this` type, so the call's own arguments must still
|
|
152
|
+
* type-check; this is the widest argument type this repo's lint allows.
|
|
404
153
|
*
|
|
405
154
|
* @since 4.0.0
|
|
406
155
|
*/
|
|
407
|
-
|
|
156
|
+
type Argument = object | string | number | boolean | bigint | symbol | null | undefined;
|
|
408
157
|
/**
|
|
158
|
+
* What a body yields and returns: the checks it was handed, then the Effects it yields.
|
|
159
|
+
*
|
|
409
160
|
* @since 4.0.0
|
|
410
161
|
*/
|
|
411
|
-
<
|
|
162
|
+
type Body<Eff, AEff> = (checks: Checks) => Generator<Eff, AEff, never>;
|
|
412
163
|
/**
|
|
413
|
-
*
|
|
164
|
+
* A row body: the row first, then the checks — the order Vitest's `it.for` passes them (R9).
|
|
414
165
|
*
|
|
415
166
|
* @since 4.0.0
|
|
416
167
|
*/
|
|
417
|
-
<
|
|
168
|
+
type RowBody<Row, Eff, AEff> = (row: Row, checks: Checks) => Generator<Eff, AEff, never>;
|
|
418
169
|
/**
|
|
170
|
+
* Whether `Eff` still stands at the placeholder the checker uses while it is inferring a body's yields.
|
|
171
|
+
* `unknown` is the only sound placeholder; `Sentinel` names it as a generic default, so no bare `unknown`
|
|
172
|
+
* appears at a use site.
|
|
173
|
+
*
|
|
419
174
|
* @since 4.0.0
|
|
420
175
|
*/
|
|
421
|
-
<
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
176
|
+
type Unresolved<Eff, Sentinel = unknown> = [Eff] extends [never] ? false : [Sentinel] extends [Eff] ? true : false;
|
|
177
|
+
/**
|
|
178
|
+
* The requirement a body's yields impose on the run.
|
|
179
|
+
*
|
|
180
|
+
* **Details**
|
|
181
|
+
*
|
|
182
|
+
* `Eff` is inferred from what the body yields. While a body is still being inferred — and always, for a body
|
|
183
|
+
* whose `{ expect }` is destructured without an annotation — `Eff` stands at the checker's placeholder, and
|
|
184
|
+
* this reads that placeholder as the checks' own requirement. The body's real yields decide once inference
|
|
185
|
+
* settles, which is what refuses a body that yields no check at the test name (R4).
|
|
186
|
+
*
|
|
187
|
+
* @since 4.0.0
|
|
188
|
+
*/
|
|
189
|
+
type RequirementOf<Eff> = [Eff] extends [never] ? never : [Eff] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R : Unresolved<Eff> extends true ? Asserted : never;
|
|
427
190
|
/**
|
|
191
|
+
* What a lane provides besides its block's layer: the scope the body runs in, and the checks it yields.
|
|
192
|
+
*
|
|
428
193
|
* @since 4.0.0
|
|
429
194
|
*/
|
|
430
|
-
|
|
431
|
-
(...args: TestArgs): Effect.Effect<A, E, R>;
|
|
432
|
-
}
|
|
195
|
+
type Lane<R> = R | Scope.Scope | Asserted;
|
|
433
196
|
/**
|
|
197
|
+
* The no-check gate, on the test name (KTD4). It reads the tuple form so a distributive `Exclude` cannot widen
|
|
198
|
+
* `R`, and it sits on the name rather than the body because a body with a destructured `{ expect }` is
|
|
199
|
+
* context-sensitive: a gate on the body is judged before `{ expect }` is inferred, so it cannot see the checks.
|
|
200
|
+
*
|
|
434
201
|
* @since 4.0.0
|
|
435
202
|
*/
|
|
436
|
-
type
|
|
203
|
+
type Gate<R, Provided = never> = [R] extends [Asserted | Provided] ? [Asserted] extends [R] ? string : NoCheckRefusal : UnprovidedRefusal;
|
|
437
204
|
/**
|
|
205
|
+
* A body that is not the generator itself, as a parameter union: the error prints the rewrite (KTD3). A sync
|
|
206
|
+
* body, an `async` body and an Effect-returning body each reach one of these texts, at compile time and at run
|
|
207
|
+
* time (R2).
|
|
208
|
+
*
|
|
438
209
|
* @since 4.0.0
|
|
439
210
|
*/
|
|
440
|
-
type
|
|
211
|
+
type BodyRefusal = RefuseSyncBody | RefuseAsyncBody | RefuseEffectBody;
|
|
441
212
|
/**
|
|
213
|
+
* A test lane: `it(name, function* ({ expect }) { ... })`. `R` is what the lane's own environment provides
|
|
214
|
+
* besides the checks — its scope, and the services of the `layer` block it is written in.
|
|
215
|
+
*
|
|
442
216
|
* @since 4.0.0
|
|
443
217
|
*/
|
|
444
218
|
interface Test<R> {
|
|
445
|
-
<
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
219
|
+
<Eff, AEff>(name: NoInfer<Gate<RequirementOf<Eff>, Lane<R>>>, body: Body<Eff, AEff> | BodyRefusal, timeout?: number | V.TestOptions): void;
|
|
220
|
+
<Eff, AEff>(body: Body<Eff, AEff> | BodyRefusal, timeout?: number | V.TestOptions): (name: NoInfer<Gate<RequirementOf<Eff>, Lane<R>>>) => void;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A row lane: `it.each(rows)(name, function* (row, { expect }) { ... })`.
|
|
224
|
+
*
|
|
225
|
+
* @since 4.0.0
|
|
226
|
+
*/
|
|
227
|
+
interface RowTest<Row, R> {
|
|
228
|
+
<Eff, AEff>(name: NoInfer<Gate<RequirementOf<Eff>, Lane<R>>>, body: RowBody<Row, Eff, AEff> | BodyRefusal, timeout?: number | V.TestOptions): void;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The `it` modifiers every lane has, each registering the same generator body.
|
|
232
|
+
*
|
|
233
|
+
* @since 4.0.0
|
|
234
|
+
*/
|
|
235
|
+
interface Modifiers<R> {
|
|
236
|
+
readonly skip: Test<R>;
|
|
237
|
+
readonly skipIf: (condition: boolean) => Test<R>;
|
|
238
|
+
readonly runIf: (condition: boolean) => Test<R>;
|
|
239
|
+
readonly only: Test<R>;
|
|
240
|
+
readonly fails: Test<R>;
|
|
241
|
+
readonly each: <Row>(cases: ReadonlyArray<Row>) => RowTest<Row, R>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* A lane with the Effect-lane property attached: `it.live.prop(...)` and `it.effect.prop(...)`.
|
|
245
|
+
*
|
|
246
|
+
* @since 4.0.0
|
|
247
|
+
*/
|
|
248
|
+
interface Tester<R> extends Test<R>, Modifiers<R> {
|
|
249
|
+
readonly prop: EffectProperty<R>;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A removed habit lane: calling it is a `this`-type error naming the lane and its rewrite, and a run-time
|
|
253
|
+
* throw with the same text (R9, KTD3). `Refusal` is that lane's own text, so `it.scoped` blames `it.scoped`
|
|
254
|
+
* and `it.effect` blames `it.effect`. It keeps `prop`, so `it.effect.prop` still runs properties.
|
|
255
|
+
*
|
|
256
|
+
* @since 4.0.0
|
|
257
|
+
*/
|
|
258
|
+
interface EffectLane<R, Refusal extends string = EffectLaneRefusal> {
|
|
259
|
+
(this: Refusal, ...args: ReadonlyArray<Argument>): never;
|
|
260
|
+
readonly prop: EffectProperty<R | Scope.Scope>;
|
|
452
261
|
}
|
|
453
262
|
/**
|
|
454
263
|
* A generated input: a Schema, or an Arbitrary of an already-generated type.
|
|
@@ -482,6 +291,21 @@ export declare namespace Vitest {
|
|
|
482
291
|
* @since 4.0.0
|
|
483
292
|
*/
|
|
484
293
|
type PropertySpec<G extends Gens, S extends PropertySubject, N extends number> = PropertySpec$1<G, S, N>;
|
|
294
|
+
/**
|
|
295
|
+
* A property's `holds` on the Effect lane: the verdict is an `Effect` of the literal boolean.
|
|
296
|
+
*
|
|
297
|
+
* @since 4.0.0
|
|
298
|
+
*/
|
|
299
|
+
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;
|
|
300
|
+
/**
|
|
301
|
+
* A property's `holds` on the sync lane: the verdict is a literal boolean.
|
|
302
|
+
*
|
|
303
|
+
* @since 4.0.0
|
|
304
|
+
*/
|
|
305
|
+
type SyncProperty = {
|
|
306
|
+
<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;
|
|
307
|
+
<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;
|
|
308
|
+
};
|
|
485
309
|
/**
|
|
486
310
|
* The block a layer opens: `layer(L)(body)` or `layer(L)("name", body)`.
|
|
487
311
|
*
|
|
@@ -516,39 +340,16 @@ export declare namespace Vitest {
|
|
|
516
340
|
*/
|
|
517
341
|
type FlakyTest = typeof flakyTest$1;
|
|
518
342
|
/**
|
|
343
|
+
* The lanes a `layer` block hands its body: the generator lanes, the fences a property lives in, and the
|
|
344
|
+
* removal of the Effect lane as a callable. `R` is what the block's layer provides; the lanes carry the
|
|
345
|
+
* block's own scope beside it, which is why the base callable is `Test<R | Scope.Scope>`.
|
|
346
|
+
*
|
|
519
347
|
* @since 4.0.0
|
|
520
348
|
*/
|
|
521
|
-
interface
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
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>;
|
|
349
|
+
interface MethodsNonLive<R = never> extends Test<R | Scope.Scope>, Modifiers<R | Scope.Scope> {
|
|
350
|
+
readonly effect: EffectLane<R, EffectLaneRefusal>;
|
|
351
|
+
readonly scoped: EffectLane<R, ScopedLaneRefusal>;
|
|
352
|
+
readonly scopedLive: EffectLane<R, ScopedLiveLaneRefusal>;
|
|
552
353
|
readonly flakyTest: FlakyTest;
|
|
553
354
|
readonly layer: LayerOf<R, NestedLayerOptions>;
|
|
554
355
|
/**
|
|
@@ -567,10 +368,7 @@ export declare namespace Vitest {
|
|
|
567
368
|
*
|
|
568
369
|
* @since 4.0.0
|
|
569
370
|
*/
|
|
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
|
-
};
|
|
371
|
+
readonly prop: SyncProperty;
|
|
574
372
|
/**
|
|
575
373
|
* The R13 law kinds: `model`, `metamorphic`, `roundTrip` and `invariant` are gated like `prop`;
|
|
576
374
|
* `idempotent` and `deterministic` skip the impostor gate and are reported as exempt.
|
|
@@ -580,76 +378,66 @@ export declare namespace Vitest {
|
|
|
580
378
|
readonly law: LawApi;
|
|
581
379
|
}
|
|
582
380
|
/**
|
|
381
|
+
* The top-level methods: `MethodsNonLive` plus the real-clock lane and the top-level `layer`.
|
|
382
|
+
*
|
|
583
383
|
* @since 4.0.0
|
|
584
384
|
*/
|
|
585
385
|
interface Methods<R = never> extends MethodsNonLive<R> {
|
|
586
|
-
readonly live:
|
|
386
|
+
readonly live: Tester<R | Scope.Scope>;
|
|
587
387
|
readonly layer: LayerOf<R, LayerOptions>;
|
|
588
388
|
}
|
|
589
389
|
}
|
|
590
390
|
/**
|
|
391
|
+
* The fork's test API, with the generator lanes of R2 and R9.
|
|
392
|
+
*
|
|
591
393
|
* @since 4.0.0
|
|
592
394
|
*/
|
|
593
|
-
export
|
|
594
|
-
/**
|
|
595
|
-
* @since 4.0.0
|
|
596
|
-
*/
|
|
597
|
-
export type Methods<R = never> = Vitest.Methods<R>;
|
|
395
|
+
export declare const it: Vitest.Methods;
|
|
598
396
|
/**
|
|
397
|
+
* The same lanes under the other name upstream publishes.
|
|
398
|
+
*
|
|
599
399
|
* @since 4.0.0
|
|
600
400
|
*/
|
|
601
|
-
export declare const
|
|
401
|
+
export declare const test: Vitest.Methods;
|
|
602
402
|
/**
|
|
403
|
+
* The fork's lawful collector: it forces the fork's concurrency and shuffle defaults and hands its body the
|
|
404
|
+
* fork's methods.
|
|
405
|
+
*
|
|
603
406
|
* @since 4.0.0
|
|
604
407
|
*/
|
|
605
|
-
export declare const
|
|
408
|
+
export declare const describeWrapped: {
|
|
409
|
+
(name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
|
|
410
|
+
(f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
|
|
411
|
+
};
|
|
606
412
|
/**
|
|
607
413
|
* @since 4.0.0
|
|
608
414
|
*/
|
|
609
|
-
export declare const
|
|
415
|
+
export declare const describe: {
|
|
416
|
+
(name: string, f: (it: Vitest.Methods) => void): V.SuiteCollector;
|
|
417
|
+
(f: (it: Vitest.Methods) => void): (name: string) => V.SuiteCollector;
|
|
418
|
+
};
|
|
610
419
|
/**
|
|
611
|
-
* Share a `Layer` between multiple tests, optionally wrapping
|
|
612
|
-
*
|
|
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
|
|
420
|
+
* Share a `Layer` between multiple tests, optionally wrapping the tests in a `describe` block if a name is
|
|
421
|
+
* provided. Every test in the block gets its own fresh build of the layer, unless the block declares
|
|
422
|
+
* `shared: true`.
|
|
619
423
|
*
|
|
620
424
|
* ```ts
|
|
621
|
-
* import {
|
|
622
|
-
* import { Effect, Layer
|
|
425
|
+
* import { it, layer } from "@systemfsoftware/vitest"
|
|
426
|
+
* import { Context, Effect, Layer } from "effect"
|
|
623
427
|
*
|
|
624
428
|
* class Foo extends Context.Service<Foo, "foo">()("Foo") {
|
|
625
429
|
* static layer = Layer.succeed(Foo, "foo")
|
|
626
430
|
* }
|
|
627
431
|
*
|
|
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
432
|
* layer(Foo.layer)("layer", (it) => {
|
|
636
|
-
* it
|
|
637
|
-
*
|
|
638
|
-
*
|
|
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
|
-
* }))
|
|
433
|
+
* it("reads the service", function* ({ expect }) {
|
|
434
|
+
* const foo = yield* Foo
|
|
435
|
+
* yield* expect(foo).toEqual("foo")
|
|
650
436
|
* })
|
|
651
437
|
* })
|
|
652
438
|
* ```
|
|
439
|
+
*
|
|
440
|
+
* @since 4.0.0
|
|
653
441
|
*/
|
|
654
442
|
export declare const layer: Vitest.LayerOf<never, Vitest.LayerOptions>;
|
|
655
443
|
/**
|
|
@@ -659,77 +447,52 @@ export declare const flakyTest: Vitest.FlakyTest;
|
|
|
659
447
|
/**
|
|
660
448
|
* @since 4.0.0
|
|
661
449
|
*/
|
|
662
|
-
export declare const prop: Vitest.
|
|
450
|
+
export declare const prop: Vitest.SyncProperty;
|
|
663
451
|
/**
|
|
664
452
|
* @since 4.0.0
|
|
665
453
|
*/
|
|
666
|
-
export declare const
|
|
454
|
+
export declare const law: LawApi;
|
|
667
455
|
/**
|
|
668
|
-
*
|
|
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.
|
|
456
|
+
* The fork's test API over another Vitest `it`, so a library can register tests in its own suite.
|
|
676
457
|
*
|
|
677
458
|
* @since 4.0.0
|
|
678
459
|
*/
|
|
679
|
-
export declare const
|
|
460
|
+
export declare const makeMethods: (it: V.TestAPI) => Vitest.Methods;
|
|
680
461
|
/**
|
|
681
|
-
*
|
|
682
|
-
* context builds that view on this key, so the context a case lane sees and a property lane sees agree.
|
|
462
|
+
* Refused: hooks share state between tests, and services come fresh per test from `layer`.
|
|
683
463
|
*
|
|
684
464
|
* @since 4.0.0
|
|
685
465
|
*/
|
|
686
|
-
export declare const
|
|
466
|
+
export declare const beforeEach: typeof beforeEach$2;
|
|
687
467
|
/**
|
|
688
|
-
*
|
|
689
|
-
* lanes, and each `it.each` row. It is `null` outside a run.
|
|
468
|
+
* Refused: hooks share state between tests, and services come fresh per test from `layer`.
|
|
690
469
|
*
|
|
691
470
|
* @since 4.0.0
|
|
692
471
|
*/
|
|
693
|
-
export declare const
|
|
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;
|
|
472
|
+
export declare const afterEach: typeof afterEach$1;
|
|
702
473
|
/**
|
|
703
474
|
* @since 4.0.0
|
|
704
475
|
*/
|
|
705
|
-
export declare const
|
|
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
|
-
};
|
|
476
|
+
export declare const addEqualityTesters: () => void;
|
|
713
477
|
/**
|
|
714
|
-
* The
|
|
478
|
+
* The key the running test's context is published under. A library that carries its own view of the task
|
|
479
|
+
* context builds that view on this key, so the context a case lane sees and a property lane sees agree.
|
|
715
480
|
*
|
|
716
481
|
* @since 4.0.0
|
|
717
482
|
*/
|
|
718
|
-
export declare const
|
|
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;
|
|
483
|
+
export declare const vitestTestContextKey: string;
|
|
727
484
|
/**
|
|
485
|
+
* The running Vitest `TestContext`, provided on every test the fork runs — every generator lane, both property
|
|
486
|
+
* lanes, and each `it.each` row. It is `null` outside a run.
|
|
487
|
+
*
|
|
728
488
|
* @since 4.0.0
|
|
729
489
|
*/
|
|
730
|
-
export declare const
|
|
490
|
+
export declare const VitestTestContext: Context.Reference<V.TestContext | null>;
|
|
731
491
|
/**
|
|
492
|
+
* The no-check gate, on the test name (KTD4).
|
|
493
|
+
*
|
|
732
494
|
* @since 4.0.0
|
|
733
495
|
*/
|
|
734
|
-
export
|
|
735
|
-
//#endregion
|
|
496
|
+
export type Gate<R, Provided = never> = Vitest.Gate<R, Provided>;
|
|
497
|
+
//#endregion
|
|
498
|
+
export { type Asserted, type Check, type Checks, type Expect, afterAll, assertType, beforeAll, expectTypeOf, inject, onTestFailed, onTestFinished, recordArtifact, vi, vitest };
|