@systemfsoftware/vitest 0.2.0 → 1.0.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/failure.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
 
2
- import { a as Values, i as PropertySubject, n as Gens, o as engine_d_exports, r as PropertySpec } from "./engine-YsoQ_9we.js";
3
- import { S as summaryOf, _ as FailureRecord, b as TestIdentity, g as Breach, h as AttributeValue, i as Checks, t as Asserted, v as FailureRecordInput, x as renderFailureRecord, y as ReplayValue } from "./checks-Cq9of-Lx.js";
4
- import * as Effect from "effect/Effect";
2
+ import { a as Values, i as PropertySubject, l as Breach, n as Gens, o as engine_d_exports, r as PropertySpec } from "./engine-CMvYG5V0.js";
3
+ import { i as Checks, t as Asserted } from "./checks-DiuzHhQM.js";
4
+ import * as Cause from "effect/Cause";
5
+ import * as Effect$1 from "effect/Effect";
5
6
  import * as Tracer from "effect/Tracer";
7
+ import { Option, Schema } from "effect";
6
8
  //#region src/internal/call-site.d.ts
7
9
  /** @internal */
8
10
  export declare const callFrameOutside: (library: RegExp) => string | undefined;
@@ -14,38 +16,134 @@ export declare const withRaisingFrame: {
14
16
  (frame: string | undefined): <A extends Error>(error: A) => A;
15
17
  };
16
18
  //#endregion
17
- //#region src/internal/failure-error.d.ts
19
+ //#region src/internal/failure-record.d.ts
20
+ /** A value the renderer narrows rather than assumes. */
21
+ type Opaque<A = unknown> = A;
18
22
  /**
19
- * Renders the record and throws what Vitest prints for it: the record itself when it holds its contract, a
20
- * `FailureRecordRefused` when it breaks one, and a refusal passed in unchanged, so refusing cannot recurse (R10).
23
+ * A value a recorded span attribute or a replay path carries. Structured values stay structured on the span
24
+ * (KTD2); the renderer decides the text.
21
25
  *
22
26
  * @internal
23
27
  */
28
+ type AttributeValue = string | number | boolean | null | ReadonlyArray<AttributeValue> | {
29
+ readonly [key: string]: AttributeValue;
30
+ };
31
+ /**
32
+ * The test a failure happened in, as Vitest knows it. `file` is the path the rerun command names, so a caller
33
+ * that holds an absolute path derives the repo-relative one before handing it over.
34
+ *
35
+ * @internal
36
+ */
37
+ interface TestIdentity {
38
+ /**
39
+ * The npm package the test file belongs to, e.g. `@systemfsoftware/effect-readiness`. Empty when the run
40
+ * provided no name: the rerun command then drops its `pnpm --filter` prefix and runs from the package
41
+ * directory, which is not a breach (R6).
42
+ */
43
+ readonly package: string;
44
+ /** The test file, as the rerun command writes it. */
45
+ readonly file: string;
46
+ /** The scenario name the rerun command filters on with `-t`. */
47
+ readonly name: string;
48
+ }
49
+ /**
50
+ * The value a generator chose a run by: the kernel's seed and decision path, or a property counterexample's
51
+ * seed and path. A path without a seed is a replay value offered for a baseline run, which R6 refuses (KTD5).
52
+ *
53
+ * @internal
54
+ */
55
+ interface ReplayValue {
56
+ /** The generator's seed, or `undefined` when only a path was recorded. */
57
+ readonly seed: number | undefined;
58
+ /** The decisions the generator chose, in order; a decision is the index the scheduler picked (KTD5). */
59
+ readonly path: ReadonlyArray<number>;
60
+ }
61
+ /**
62
+ * A contract rule a rendered record breaks; the runner refuses such a record (R10, KTD7).
63
+ *
64
+ * @internal
65
+ */
66
+ /**
67
+ * What a rendered failure gives Vitest: the tag the error carries, the record text, and the rules it breaks.
68
+ *
69
+ * @internal
70
+ */
71
+ interface FailureRecord {
72
+ /** The headline's failure tag, e.g. `StepError`; the runner sets it as the thrown error's `name`. */
73
+ readonly name: string;
74
+ /** The text Vitest prints as the failure's message. */
75
+ readonly record: string;
76
+ /** The contract rules the record breaks: `R1` empty headline, `R2` no location, `R6` replay or rerun. */
77
+ readonly breaches: ReadonlyArray<Breach>;
78
+ }
79
+ /**
80
+ * Everything one failure is rendered from: the failure, its run's spans, the test and the replay value.
81
+ *
82
+ * @internal
83
+ */
84
+ interface FailureRecordInput<E = never> {
85
+ /** The failure itself: a `Cause`, or the value a program threw or failed with. */
86
+ readonly failure: Cause.Cause<E> | E;
87
+ /** Every span the failing run recorded, in creation order. */
88
+ readonly spans: ReadonlyArray<Tracer.NativeSpan>;
89
+ /** The test the run belonged to. */
90
+ readonly identity: TestIdentity;
91
+ /** The generator that chose this run, or `undefined` on a run no generator chose. */
92
+ readonly replay: ReplayValue | undefined;
93
+ /**
94
+ * The seed the kernel's scheduler chose. The kernel knows its own scheduler, so it hands the note over rather
95
+ * than the renderer guessing it; a run no scheduler chose renders no note (KTD5).
96
+ */
97
+ readonly schedule?: {
98
+ readonly seed: number;
99
+ } | undefined;
100
+ /**
101
+ * The workspace root the rendered paths are relativized against, provided by the shared config the same way the
102
+ * package name is. Omitted, paths print absolute.
103
+ */
104
+ readonly root?: string | undefined;
105
+ }
106
+ /** @internal */
107
+ export declare const summaryOf: (value: Opaque) => string;
108
+ /**
109
+ * Renders the record Vitest prints for one spec failure, and the contract rules it breaks.
110
+ *
111
+ * Never throws: a `Cause` renders layer by layer, a thrown `Error` renders as one layer, and any other value
112
+ * renders as itself. The first location the record names is the raising frame — the first stack frame outside
113
+ * `node_modules` and outside the spec libraries' own `src/` and `dist/` — and when no layer has one, the
114
+ * innermost failed span's site stands in, or the innermost unfinished cell's decide site for a deadlock (KTD6).
115
+ *
116
+ * @internal
117
+ */
118
+ export declare const renderFailureRecord: <E>(input: FailureRecordInput<E>) => FailureRecord;
119
+ /** @internal */
24
120
  export declare const throwFailureRecord: <E>(input: FailureRecordInput<E>) => never;
25
- //#endregion
26
- //#region src/internal/failure-identity.d.ts
27
- /** The fields this reads off a Vitest task: every one optional, so a partial context yields an incomplete identity. */
28
121
  interface TaskLike {
29
122
  readonly name?: string | undefined;
30
123
  readonly fullName?: string | undefined;
31
124
  readonly fullTestName?: string | undefined;
32
125
  }
126
+ /** @internal */
127
+ export declare const testIdentityOf: (task?: TaskLike | null) => TestIdentity;
128
+ //#endregion
129
+ //#region src/internal/provided.schema.d.ts
33
130
  /**
34
- * The identity of the test being run, or of the task handed in. A run outside a test, or one whose task carries
35
- * no file, yields an incomplete identity, which the renderer reports as the R6 breach it is.
131
+ * The workspace root every rendered path is relativized against.
36
132
  *
37
133
  * @internal
38
134
  */
39
- export declare const testIdentityOf: (task?: TaskLike | null) => TestIdentity;
135
+ declare const WorkspaceRoot: Schema.brand<Schema.NonEmptyString, "WorkspaceRoot">;
136
+ /** @internal */
137
+ type WorkspaceRoot = typeof WorkspaceRoot.Type;
40
138
  //#endregion
41
139
  //#region src/internal/provided.d.ts
42
140
  /** @internal */
43
- declare const providedRoot: () => string | undefined;
141
+ declare const providedRoot: () => WorkspaceRoot | undefined;
44
142
  //#endregion
45
143
  //#region src/internal/recorded-run.d.ts
46
144
  /** @internal */
47
145
  interface RecordedRun<A, E> {
48
- (checks: Checks): Effect.Effect<A, E, Asserted>;
146
+ (checks: Checks): Effect$1.Effect<A, E, Asserted>;
49
147
  }
50
148
  /** @internal */
51
149
  interface RecordedProperty<G extends Gens, S extends PropertySubject, N extends number> {
@@ -77,4 +175,30 @@ interface SpanRecorder {
77
175
  /** @internal */
78
176
  export declare const createSpanRecorder: () => SpanRecorder;
79
177
  //#endregion
80
- export { type AttributeValue, type Breach, type FailureRecord, type FailureRecordInput, type RecordedProperty, type RecordedRun, type ReplayValue, type SpanRecorder, type TestIdentity, providedRoot as providedWorkspaceRoot, renderFailureRecord, summaryOf };
178
+ //#region src/replay.schema.d.ts
179
+ /** The replay a generator chose: its seed and the decisions it took, in order (R6). */
180
+ export declare const Replay: Schema.Struct<{
181
+ readonly seed: Schema.brand<Schema.Int, "ReplaySeed">;
182
+ readonly path: Schema.$Array<Schema.brand<Schema.Int, "ReplayStep">>;
183
+ }>;
184
+ /** @since 4.0.0 */
185
+ export type Replay = typeof Replay.Type;
186
+ /**
187
+ * The `CONFORMANCE_REPLAY` text as the replay it names. A text a seed and a path cannot be read out of is refused
188
+ * with the same prose the spec runtime has always thrown, so the grammar and its refusal share one home.
189
+ *
190
+ * @since 4.0.0
191
+ */
192
+ export declare const replayOfText: (text: string) => Replay;
193
+ /**
194
+ * The replay codec: `Schema.String` in, a replay out. A text that names no seed and path fails the decode, and
195
+ * every replay encodes back to the text it was read from.
196
+ *
197
+ * @since 4.0.0
198
+ */
199
+ export declare const ReplayFromText: Schema.decodeTo<Schema.Struct<{
200
+ readonly seed: Schema.brand<Schema.Int, "ReplaySeed">;
201
+ readonly path: Schema.$Array<Schema.brand<Schema.Int, "ReplayStep">>;
202
+ }>, Schema.String, never, never>;
203
+ //#endregion
204
+ export { type AttributeValue, type Breach, type FailureRecord, type FailureRecordInput, type RecordedProperty, type RecordedRun, type ReplayValue, type SpanRecorder, type TestIdentity, providedRoot as providedWorkspaceRoot };
package/dist/failure.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- import { d as summaryOf, l as throwFailureRecord, n as recordOfRun, o as testIdentityOf, r as createSpanRecorder, s as providedRoot, t as recordOfProperty, u as renderFailureRecord } from "./failure-BquJJPFZ.mjs";
3
- import { c as callFrameOutside, l as callSite, p as withRaisingFrame } from "./test-context-ChvjVyCo.mjs";
4
- export { callFrameOutside, callSite, createSpanRecorder, providedRoot as providedWorkspaceRoot, recordOfProperty, recordOfRun, renderFailureRecord, summaryOf, testIdentityOf, throwFailureRecord, withRaisingFrame };
2
+ import { _ as ReplayFromText, c as summaryOf, d as providedRoot, g as Replay, l as testIdentityOf, n as recordOfRun, r as createSpanRecorder, s as renderFailureRecord, t as recordOfProperty, u as throwFailureRecord, v as replayOfText } from "./failure-D8mPXwf4.mjs";
3
+ import { c as callFrameOutside, l as callSite, p as withRaisingFrame } from "./test-context-D_-acRSc.mjs";
4
+ export { Replay, ReplayFromText, callFrameOutside, callSite, createSpanRecorder, providedRoot as providedWorkspaceRoot, recordOfProperty, recordOfRun, renderFailureRecord, replayOfText, summaryOf, testIdentityOf, throwFailureRecord, withRaisingFrame };
@@ -2,6 +2,16 @@
2
2
  import { chai } from "vitest";
3
3
  //#region src/internal/refusals.ts
4
4
  /**
5
+ * Every refusal the fork prints, as the one text it uses on both channels: the `this` type (or parameter union)
6
+ * the compiler prints at the call site, and the message thrown at run time.
7
+ *
8
+ * Surface: `it(name, function* ({ expect }) { ... })`. Ported verbatim from the prototype's `checks.ts`; the
9
+ * prototype's `test(` surfaces are rewritten to `it(`, and `refusedText` gained the `expect` statics
10
+ * (`.resolves`, `.rejects`, `expect.anything`, `expect.poll`, `expect.soft`).
11
+ *
12
+ * @since 4.0.0
13
+ */
14
+ /**
5
15
  * The brand every run-time refusal carries. A test is run a second time on a fresh build to catch leaked state,
6
16
  * so when that second run fails with a refusal the fork itself made, the runner re-throws the refusal rather than
7
17
  * relabelling it as a leak (see `throwSecondRun` in `runner.ts`). The brand is a `Symbol.for` value because a
@@ -81,20 +91,6 @@ const refuseHook = "✗ hooks share state between tests. Build what a test needs
81
91
  const refuseRawExpect = "✗ an expect imported from vitest ran; take it from the test callback: it(name, function* ({ expect }) { ... })";
82
92
  /** @internal */
83
93
  const refuseRawIt = "✗ this test was registered with vitest's it; import it from @systemfsoftware/vitest";
84
- /**
85
- * The fixed prose each breach of the record contract is refused with (R10, KTD7). A refusal carries this text and
86
- * nothing from the record itself, and nothing ever reads it back, so a refusal cannot recurse. The breach letter is
87
- * not printed: a reader acts on what is missing, not on which requirement numbered it.
88
- */
89
- /** @internal */
90
- const refusedRecordText = {
91
- R1: "the headline is empty",
92
- R2: "the record names no source location",
93
- R6: "a replay value names a run no generator chose, or the rerun line is missing"
94
- };
95
- /** The one detail a record refusal carries: every breach the renderer found, in the prose above (R10). */
96
- /** @internal */
97
- const refusedRecordDetail = (breaches) => `✗ refused a failure record: ${breaches.map((breach) => refusedRecordText[breach]).join(", and ")}`;
98
94
  //#endregion
99
95
  //#region src/internal/guard.ts
100
96
  /**
@@ -247,4 +243,4 @@ const installGuard = () => {
247
243
  patchExtend();
248
244
  };
249
245
  //#endregion
250
- export { unprovidedText as S, refuseScopedLiveLane as _, booleanRefusal as a, refusedRecordDetail as b, negatedText as c, refuseAsyncBody as d, refuseEffectLane as f, refuseScopedLane as g, refuseRawIt as h, markTask as i, noCheckRefusal as l, refusePiecewise as m, installGuard as n, isRefusal as o, refuseHook as p, isMarked as r, neededText as s, authorize as t, refusalOf as u, refuseSyncBody as v, refusedText as x, refuseUnyielded as y };
246
+ export { refuseScopedLiveLane as _, booleanRefusal as a, refusedText as b, negatedText as c, refuseAsyncBody as d, refuseEffectLane as f, refuseScopedLane as g, refuseRawIt as h, markTask as i, noCheckRefusal as l, refusePiecewise as m, installGuard as n, isRefusal as o, refuseHook as p, isMarked as r, neededText as s, authorize as t, refusalOf as u, refuseSyncBody as v, unprovidedText as x, refuseUnyielded as y };
package/dist/guard.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { h as refuseRawIt, n as installGuard, r as isMarked, u as refusalOf } from "./guard-p_8ARgPm.mjs";
2
+ import { h as refuseRawIt, n as installGuard, r as isMarked, u as refusalOf } from "./guard-BocOhXt2.mjs";
3
3
  import { beforeEach } from "vitest";
4
4
  //#region src/guard.ts
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="./compat.d.ts" />
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";
2
+ import { a as Values$1, c as kinds_d_exports, i as PropertySubject$1, n as Gens$1, o as engine_d_exports, r as PropertySpec$1, s as LawApi, t as ArbitraryInput, u as __exportAll } from "./engine-CMvYG5V0.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-DiuzHhQM.js";
4
4
  import * as V from "vitest";
5
5
  import { afterAll, assertType, beforeAll, expectTypeOf, inject, onTestFailed, onTestFinished, recordArtifact, vi, vitest } from "vitest";
6
6
  import * as Duration from "effect/Duration";
@@ -9,7 +9,7 @@ import * as Layer from "effect/Layer";
9
9
  import * as Scope from "effect/Scope";
10
10
  import * as TestConsole from "effect/testing/TestConsole";
11
11
  import * as Context from "effect/Context";
12
- import * as Arbitrary from "effect/unstable/arbitrary/Arbitrary";
12
+ import * as Arbitrary from "effect/Arbitrary";
13
13
  import * as Clock from "effect/Clock";
14
14
  import * as Scheduler from "effect/Scheduler";
15
15
  //#region src/internal/property/defaults.d.ts
package/dist/index.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
 
2
- import { a as replayOfFailure, c as isFailureRecordError, f as InvalidBudget, h as Slop, i as makeProperty, l as throwFailureRecord, m as NonBooleanVerdict, o as testIdentityOf, p as LeakedState, r as createSpanRecorder, s as providedRoot } from "./failure-BquJJPFZ.mjs";
3
- import { a as isCheck, i as checksFor, n as vitestTestContextKey$1, o as makeLedger, r as Asserted, t as VitestTestContext$1 } from "./test-context-ChvjVyCo.mjs";
4
- import { S as unprovidedText, _ as refuseScopedLiveLane, d as refuseAsyncBody, f as refuseEffectLane, g as refuseScopedLane, i as markTask, l as noCheckRefusal, o as isRefusal$1, p as refuseHook, u as refusalOf$1, v as refuseSyncBody, y as refuseUnyielded } from "./guard-p_8ARgPm.mjs";
2
+ import { a as replayOfFailure, d as providedRoot, f as InvalidBudget, h as Slop, i as makeProperty, l as testIdentityOf, m as NonBooleanVerdict, o as isFailureRecordError, p as LeakedState, r as createSpanRecorder, u as throwFailureRecord } from "./failure-D8mPXwf4.mjs";
3
+ import { a as isCheck, i as checksFor, n as vitestTestContextKey$1, o as makeLedger, r as Asserted, t as VitestTestContext$1 } from "./test-context-D_-acRSc.mjs";
4
+ import { _ as refuseScopedLiveLane, d as refuseAsyncBody, f as refuseEffectLane, g as refuseScopedLane, i as markTask, l as noCheckRefusal, o as isRefusal$1, p as refuseHook, u as refusalOf$1, v as refuseSyncBody, x as unprovidedText, y as refuseUnyielded } from "./guard-BocOhXt2.mjs";
5
5
  import * as V from "vitest";
6
6
  import { afterAll, assertType, beforeAll, expectTypeOf, inject, onTestFailed, onTestFinished, recordArtifact, vi, vitest } from "vitest";
7
7
  import * as Cause from "effect/Cause";
8
8
  import * as Duration from "effect/Duration";
9
9
  import * as Effect from "effect/Effect";
10
+ import * as Equal from "effect/Equal";
10
11
  import * as Exit from "effect/Exit";
11
12
  import * as Function from "effect/Function";
12
13
  import * as Layer from "effect/Layer";
@@ -15,7 +16,6 @@ import * as Schema from "effect/Schema";
15
16
  import * as Scope from "effect/Scope";
16
17
  import * as TestClock from "effect/testing/TestClock";
17
18
  import * as TestConsole from "effect/testing/TestConsole";
18
- import * as Equal from "effect/Equal";
19
19
  import * as Clock from "effect/Clock";
20
20
  import * as Scheduler from "effect/Scheduler";
21
21
  //#region src/internal/driver.ts
@@ -84,18 +84,6 @@ const driven = (body, args, ledger) => Effect.provideService(driveBody(body, arg
84
84
  */
85
85
  const drive = Function.dual(3, driven);
86
86
  //#endregion
87
- //#region src/internal/equal.ts
88
- let registered = false;
89
- /** @internal */
90
- const registerEqualTester = () => {
91
- if (registered) return;
92
- registered = true;
93
- V.expect.addEqualityTesters([equalTester]);
94
- };
95
- const equalTester = (first, second) => equalTogether(first, second) ? true : void 0;
96
- const equalTogether = (first, second) => bothEqualable(first, second) && Equal.equals(first, second);
97
- const bothEqualable = (first, second) => Equal.isEqual(first) && Equal.isEqual(second);
98
- //#endregion
99
87
  //#region src/internal/virtual-time.ts
100
88
  const roundNanos = (millis) => BigInt(Math.round(millis * 1e6));
101
89
  const byWakeOrder = (first, second) => {
@@ -280,9 +268,18 @@ const virtualClockOf = (runtime) => {
280
268
  * `@systemfsoftware/vitest/guard` can tell the fork's tests from a test registered by Vitest itself.
281
269
  */
282
270
  const getCurrentSuite = V.TestRunner.getCurrentSuite;
271
+ let equalTestersRegistered = false;
272
+ const equalTester = (first, second) => equalTogether(first, second) ? true : void 0;
273
+ const equalTogether = (first, second) => bothEqualable(first, second) && Equal.equals(first, second);
274
+ const bothEqualable = (first, second) => Equal.isEqual(first) && Equal.isEqual(second);
275
+ const registerEqualTesters = () => {
276
+ if (equalTestersRegistered) return;
277
+ equalTestersRegistered = true;
278
+ V.expect.addEqualityTesters([equalTester]);
279
+ };
283
280
  /** @internal */
284
281
  const addEqualityTesters$1 = () => {
285
- registerEqualTester();
282
+ registerEqualTesters();
286
283
  };
287
284
  const numbered = (timeout) => ({ timeout });
288
285
  const givenOptions = (timeout) => timeout ?? {};
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as Expect, n as AssertedShape, r as Check, t as Asserted } from "./checks-Cq9of-Lx.js";
2
+ import { a as Expect, n as AssertedShape, r as Check, t as Asserted } from "./checks-DiuzHhQM.js";
3
3
  import * as Effect from "effect/Effect";
4
4
  //#region src/integration.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
 
2
- import { r as Asserted, t as VitestTestContext } from "./test-context-ChvjVyCo.mjs";
2
+ import { r as Asserted, t as VitestTestContext } from "./test-context-D_-acRSc.mjs";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Option from "effect/Option";
5
5
  //#region src/integration.ts
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as booleanRefusal, c as negatedText, m as refusePiecewise, s as neededText, t as authorize, u as refusalOf, x as refusedText } from "./guard-p_8ARgPm.mjs";
2
+ import { a as booleanRefusal, b as refusedText, c as negatedText, m as refusePiecewise, s as neededText, t as authorize, u as refusalOf } from "./guard-BocOhXt2.mjs";
3
3
  import * as V from "vitest";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as Function from "effect/Function";
@@ -43,7 +43,6 @@ const LIBRARY_DIRS = [
43
43
  const isVendoredPath = (path) => path.includes("node_modules") || path.startsWith("node:");
44
44
  const inOwnDir = (path) => (dir) => path.includes(`/${dir}/src/`) || path.includes(`/${dir}/dist/`);
45
45
  const isLibraryPath = (path) => LIBRARY_DIRS.some(inOwnDir(path));
46
- /** @internal */
47
46
  const isUserPath = (path) => and(not(isVendoredPath(path)), not(isLibraryPath(path)));
48
47
  const stripProtocol = (path) => path.startsWith(FILE_PROTOCOL) ? path.slice(7) : path;
49
48
  const isFrame = (frame) => frame !== void 0;
@@ -73,17 +72,13 @@ const frameOfLine = (line) => {
73
72
  };
74
73
  /** @internal */
75
74
  const framesOf = (stack) => stack.split("\n").map(frameOfLine).filter(isFrame);
76
- const frameSiteOf = (frame) => `${frame.path}:${frame.line}:${frame.column}`;
77
- const isUserFrame = (frame) => isUserPath(frame.path);
78
- const firstUserFrameOf = (stack) => framesOf(stack).find(isUserFrame);
79
75
  /** @internal */
80
- const firstUserSiteOf = (stack) => {
81
- const frame = firstUserFrameOf(stack);
82
- return frame === void 0 ? void 0 : frameSiteOf(frame);
83
- };
76
+ const siteOfFrame = (frame) => `${frame.path}:${frame.line}:${frame.column}`;
77
+ /** @internal */
78
+ const isUserFrame = (frame) => isUserPath(frame.path);
84
79
  const NO_LIBRARY = /$^/u;
85
80
  const currentStack = () => (/* @__PURE__ */ new Error()).stack ?? "";
86
- const isSiteOf = (library) => (frame) => and(isUserPath(frame.path), not(library.test(frame.raw)));
81
+ const isSiteOf = (library) => (frame) => and(isUserFrame(frame), not(library.test(frame.raw)));
87
82
  const firstFrameOf = (stack, library) => framesOf(stack).find(isSiteOf(library));
88
83
  /** @internal */
89
84
  const callFrameOutside = (library) => {
@@ -94,7 +89,7 @@ const callFrameOutside = (library) => {
94
89
  const callFrame = () => callFrameOutside(NO_LIBRARY);
95
90
  const callSiteOutside = (library) => {
96
91
  const frame = firstFrameOf(currentStack(), library);
97
- return frame === void 0 ? void 0 : frameSiteOf(frame);
92
+ return frame === void 0 ? void 0 : siteOfFrame(frame);
98
93
  };
99
94
  /** @internal */
100
95
  const callSite = () => callSiteOutside(NO_LIBRARY);
@@ -325,4 +320,4 @@ const vitestTestContextKey = "@systemfsoftware/vitest/TestContext";
325
320
  */
326
321
  const VitestTestContext = Context.Reference(vitestTestContextKey, { defaultValue: () => null });
327
322
  //#endregion
328
- export { isCheck as a, callFrameOutside as c, framesOf as d, isUserPath as f, checksFor as i, callSite as l, vitestTestContextKey as n, makeLedger as o, withRaisingFrame as p, Asserted as r, callFrame as s, VitestTestContext as t, firstUserSiteOf as u };
323
+ export { isCheck as a, callFrameOutside as c, isUserFrame as d, siteOfFrame as f, checksFor as i, callSite as l, vitestTestContextKey as n, makeLedger as o, withRaisingFrame as p, Asserted as r, callFrame as s, VitestTestContext as t, framesOf as u };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/vitest",
3
3
  "license": "MIT",
4
- "version": "0.2.0",
4
+ "version": "1.0.0",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -48,12 +48,19 @@
48
48
  ],
49
49
  "devDependencies": {
50
50
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
51
- "@systemfsoftware/oxlint-config-recommended": "^3.2.0",
51
+ "@systemfsoftware/oxlint-config-recommended": "^4.0.0",
52
+ "@systemfsoftware/stryker-config": "^0.1.0",
53
+ "@systemfsoftware/stryker-ignorer-effect-schema-declarations": "latest",
54
+ "@systemfsoftware/stryker-ignorer-in-source-vitest-block": "latest",
55
+ "@systemfsoftware/stryker-js": "latest",
56
+ "@systemfsoftware/stryker-js-typescript-checker": "latest",
57
+ "@systemfsoftware/stryker-js-vitest-runner": "latest",
58
+ "@systemfsoftware/stryker-test-contribution": "latest",
52
59
  "@systemfsoftware/tsconfig": "^2.0.1",
53
60
  "@systemfsoftware/tsdown-config": "^0.1.0",
54
61
  "@systemfsoftware/vitest-config": "^0.1.0",
55
62
  "@types/node": "^26",
56
- "effect": "4.0.0-rc.117",
63
+ "effect": "^4",
57
64
  "oxlint": "~1.82.0",
58
65
  "rimraf": "^6.1.3",
59
66
  "tsdown": "^0.23.0",
@@ -61,7 +68,7 @@
61
68
  "vitest": "^5"
62
69
  },
63
70
  "peerDependencies": {
64
- "effect": "4.0.0-rc.117",
71
+ "effect": "^4",
65
72
  "vitest": "^5"
66
73
  },
67
74
  "publishConfig": {
@@ -73,6 +80,7 @@
73
80
  "build": "tsdown -l warn",
74
81
  "typecheck": "tsc -b",
75
82
  "test": "vitest run",
83
+ "mutation": "stryker run",
76
84
  "test:types": "TSTYCHE_TYPESCRIPT_MODULE=tstyche-typescript tstyche",
77
85
  "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
78
86
  "attw": "attw --pack ."