@systemfsoftware/vitest 0.2.0 → 0.3.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 +6 -0
- package/dist/{checks-Cq9of-Lx.d.ts → checks-DiuzHhQM.d.ts} +1 -105
- package/dist/{engine-YsoQ_9we.d.ts → engine-ZbxyPNiN.d.ts} +13 -5
- package/dist/{failure-BquJJPFZ.mjs → failure-DC_SJoxW.mjs} +251 -175
- package/dist/failure.d.ts +139 -15
- package/dist/failure.mjs +3 -3
- package/dist/{guard-p_8ARgPm.mjs → guard-BocOhXt2.mjs} +11 -15
- package/dist/guard.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +14 -17
- package/dist/integration.d.ts +1 -1
- package/dist/integration.mjs +1 -1
- package/dist/{test-context-ChvjVyCo.mjs → test-context-D_-acRSc.mjs} +7 -12
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @systemfsoftware/vitest
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `@systemfsoftware/vitest/failure` exports `Replay`, the `ReplayFromText` codec for `CONFORMANCE_REPLAY` text (`seed=<n>;path=<steps>`), and `replayOfText`, which reads that text or throws. `ReplayValue.path` is now `ReadonlyArray<number>`, and `providedWorkspaceRoot()` returns a branded `WorkspaceRoot`.
|
|
8
|
+
|
|
3
9
|
## 0.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,111 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import * as V from "vitest";
|
|
3
|
-
import * as Cause from "effect/Cause";
|
|
4
3
|
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Tracer from "effect/Tracer";
|
|
6
4
|
import * as Context from "effect/Context";
|
|
7
|
-
//#region src/internal/failure-record.d.ts
|
|
8
|
-
/** A value the renderer narrows rather than assumes. */
|
|
9
|
-
type Opaque$1<A = unknown> = A;
|
|
10
|
-
/**
|
|
11
|
-
* A value a recorded span attribute or a replay path carries. Structured values stay structured on the span
|
|
12
|
-
* (KTD2); the renderer decides the text.
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
type AttributeValue = string | number | boolean | null | ReadonlyArray<AttributeValue> | {
|
|
17
|
-
readonly [key: string]: AttributeValue;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* The test a failure happened in, as Vitest knows it. `file` is the path the rerun command names, so a caller
|
|
21
|
-
* that holds an absolute path derives the repo-relative one before handing it over.
|
|
22
|
-
*
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
interface TestIdentity {
|
|
26
|
-
/**
|
|
27
|
-
* The npm package the test file belongs to, e.g. `@systemfsoftware/effect-readiness`. Empty when the run
|
|
28
|
-
* provided no name: the rerun command then drops its `pnpm --filter` prefix and runs from the package
|
|
29
|
-
* directory, which is not a breach (R6).
|
|
30
|
-
*/
|
|
31
|
-
readonly package: string;
|
|
32
|
-
/** The test file, as the rerun command writes it. */
|
|
33
|
-
readonly file: string;
|
|
34
|
-
/** The scenario name the rerun command filters on with `-t`. */
|
|
35
|
-
readonly name: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The value a generator chose a run by: the kernel's seed and decision path, or a property counterexample's
|
|
39
|
-
* seed and path. A path without a seed is a replay value offered for a baseline run, which R6 refuses (KTD5).
|
|
40
|
-
*
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
interface ReplayValue {
|
|
44
|
-
/** The generator's seed, or `undefined` when only a path was recorded. */
|
|
45
|
-
readonly seed: number | undefined;
|
|
46
|
-
/** The decisions or inputs the generator chose, in order. */
|
|
47
|
-
readonly path: ReadonlyArray<AttributeValue>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* A contract rule a rendered record breaks; the runner refuses such a record (R10, KTD7).
|
|
51
|
-
*
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
type Breach = 'R1' | 'R2' | 'R6';
|
|
55
|
-
/**
|
|
56
|
-
* What a rendered failure gives Vitest: the tag the error carries, the record text, and the rules it breaks.
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
interface FailureRecord {
|
|
61
|
-
/** The headline's failure tag, e.g. `StepError`; the runner sets it as the thrown error's `name`. */
|
|
62
|
-
readonly name: string;
|
|
63
|
-
/** The text Vitest prints as the failure's message. */
|
|
64
|
-
readonly record: string;
|
|
65
|
-
/** The contract rules the record breaks: `R1` empty headline, `R2` no location, `R6` replay or rerun. */
|
|
66
|
-
readonly breaches: ReadonlyArray<Breach>;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Everything one failure is rendered from: the failure, its run's spans, the test and the replay value.
|
|
70
|
-
*
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
interface FailureRecordInput<E = never> {
|
|
74
|
-
/** The failure itself: a `Cause`, or the value a program threw or failed with. */
|
|
75
|
-
readonly failure: Cause.Cause<E> | E;
|
|
76
|
-
/** Every span the failing run recorded, in creation order. */
|
|
77
|
-
readonly spans: ReadonlyArray<Tracer.NativeSpan>;
|
|
78
|
-
/** The test the run belonged to. */
|
|
79
|
-
readonly identity: TestIdentity;
|
|
80
|
-
/** The generator that chose this run, or `undefined` on a run no generator chose. */
|
|
81
|
-
readonly replay: ReplayValue | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* The seed the kernel's scheduler chose. The kernel knows its own scheduler, so it hands the note over rather
|
|
84
|
-
* than the renderer guessing it; a run no scheduler chose renders no note (KTD5).
|
|
85
|
-
*/
|
|
86
|
-
readonly schedule?: {
|
|
87
|
-
readonly seed: number;
|
|
88
|
-
} | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* The workspace root the rendered paths are relativized against, provided by the shared config the same way the
|
|
91
|
-
* package name is. Omitted, paths print absolute.
|
|
92
|
-
*/
|
|
93
|
-
readonly root?: string | undefined;
|
|
94
|
-
}
|
|
95
|
-
/** @internal */
|
|
96
|
-
declare const summaryOf: (value: Opaque$1) => string;
|
|
97
|
-
/**
|
|
98
|
-
* Renders the record Vitest prints for one spec failure, and the contract rules it breaks.
|
|
99
|
-
*
|
|
100
|
-
* Never throws: a `Cause` renders layer by layer, a thrown `Error` renders as one layer, and any other value
|
|
101
|
-
* renders as itself. The first location the record names is the raising frame — the first stack frame outside
|
|
102
|
-
* `node_modules` and outside the spec libraries' own `src/` and `dist/` — and when no layer has one, the
|
|
103
|
-
* innermost failed span's site stands in, or the innermost unfinished cell's decide site for a deadlock (KTD6).
|
|
104
|
-
*
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
declare const renderFailureRecord: <E>(input: FailureRecordInput<E>) => FailureRecord;
|
|
108
|
-
//#endregion
|
|
109
5
|
//#region src/internal/refusals.d.ts
|
|
110
6
|
/** @internal */
|
|
111
7
|
declare const refusedText: {
|
|
@@ -333,4 +229,4 @@ interface Checks {
|
|
|
333
229
|
readonly expect: Expect;
|
|
334
230
|
}
|
|
335
231
|
//#endregion
|
|
336
|
-
export {
|
|
232
|
+
export { Expect as a, NoCheckRefusal as c, RefuseSyncBody as d, ScopedLaneRefusal as f, Checks as i, RefuseAsyncBody as l, UnprovidedRefusal as m, AssertedShape as n, EffectLaneRefusal as o, ScopedLiveLaneRefusal as p, Check as r, HookRefusal as s, Asserted as t, RefuseEffectBody as u };
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
import * as Cause from "effect/Cause";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Effect$1 from "effect/Effect";
|
|
4
4
|
import * as Schema$1 from "effect/Schema";
|
|
5
5
|
import { Schema } from "effect";
|
|
6
6
|
import * as Arbitrary from "effect/unstable/arbitrary/Arbitrary";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/internal/errors.schema.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* The contract rules a rendered failure record can break (R10, KTD7).
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
declare const Breach: Schema.Literals<readonly ["R1", "R2", "R6"]>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
type Breach = typeof Breach.Type;
|
|
9
17
|
declare const NonBooleanVerdict_base: Schema.Class<NonBooleanVerdict, Schema.TaggedStruct<"NonBooleanVerdict", {
|
|
10
18
|
readonly detail: Schema.String;
|
|
11
19
|
}>, import("effect/Cause").YieldableError>;
|
|
@@ -139,13 +147,13 @@ interface PropertySpec<G extends Gens, S extends PropertySubject, N extends numb
|
|
|
139
147
|
/** @internal */
|
|
140
148
|
interface PropertyRuntime<R> {
|
|
141
149
|
/** Registers the property's program; the runtime runs it inside the test it registers, under that test's binding. */
|
|
142
|
-
readonly register: (name: string, program: () => Effect.Effect<void, Cause.Cause<NonBooleanVerdict>, never>) => void;
|
|
143
|
-
readonly provide: <A, E>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, never>;
|
|
150
|
+
readonly register: (name: string, program: () => Effect$1.Effect<void, Cause.Cause<NonBooleanVerdict>, never>) => void;
|
|
151
|
+
readonly provide: <A, E>(effect: Effect$1.Effect<A, E, R>) => Effect$1.Effect<A, E, never>;
|
|
144
152
|
}
|
|
145
153
|
/** @internal */
|
|
146
154
|
interface PropApi<R> {
|
|
147
155
|
readonly prop: <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;
|
|
148
|
-
readonly effectProp: <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;
|
|
156
|
+
readonly effectProp: <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$1.Effect<boolean, E, R>) => void;
|
|
149
157
|
readonly law: LawApi;
|
|
150
158
|
}
|
|
151
159
|
/**
|
|
@@ -155,4 +163,4 @@ interface PropApi<R> {
|
|
|
155
163
|
*/
|
|
156
164
|
declare const makeProperty: <R>(runtime: PropertyRuntime<R>) => PropApi<R>;
|
|
157
165
|
//#endregion
|
|
158
|
-
export { Values as a, kinds_d_exports as c, PropertySubject as i,
|
|
166
|
+
export { Values as a, kinds_d_exports as c, PropertySubject as i, Breach as l, Gens as n, engine_d_exports as o, PropertySpec as r, LawApi as s, ArbitraryInput as t, __exportAll as u };
|