@systemfsoftware/effect-spec-runtime 1.0.1 → 1.1.5
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 +2 -73
- package/README.md +6 -2
- package/dist/index.d.ts +11 -41
- package/dist/index.mjs +40 -27
- package/package.json +16 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,76 +1,5 @@
|
|
|
1
1
|
# @systemfsoftware/effect-spec-runtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @systemfsoftware/effect-spec-runtime@1.1.5
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- Updated dependencies:
|
|
8
|
-
- @systemfsoftware/vitest@2.0.0
|
|
9
|
-
|
|
10
|
-
## 1.0.0
|
|
11
|
-
|
|
12
|
-
### Major Changes
|
|
13
|
-
|
|
14
|
-
- Require `effect` `^4` (stable 4.0.0). Release candidates are no longer supported: imports follow 4.0.0's module layout (`effect/http`, `effect/rpc`, `effect/http-api`, `effect/cluster`, `effect/process`, `effect/socket`, `effect/persistence`, `effect/reactivity`, `effect/encoding`, `effect/Arbitrary`), which does not exist in any 4.0.0 RC.
|
|
15
|
-
|
|
16
|
-
### Patch Changes
|
|
17
|
-
|
|
18
|
-
- Updated dependencies:
|
|
19
|
-
- @systemfsoftware/effect-sim-kernel@1.0.0
|
|
20
|
-
- @systemfsoftware/vitest@1.0.0
|
|
21
|
-
|
|
22
|
-
## 0.3.2
|
|
23
|
-
|
|
24
|
-
### Patch Changes
|
|
25
|
-
|
|
26
|
-
- Updated dependencies:
|
|
27
|
-
- @systemfsoftware/vitest@0.3.0
|
|
28
|
-
|
|
29
|
-
## 0.3.1
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- A failing kernel-explored case now throws the rendered failure record. A failure on the baseline schedule no longer prints a schedule or replay value; a seeded failure still names its seed and replay path.
|
|
34
|
-
|
|
35
|
-
- Updated dependencies:
|
|
36
|
-
- @systemfsoftware/effect-sim-kernel@0.2.0
|
|
37
|
-
- @systemfsoftware/vitest@0.2.0
|
|
38
|
-
|
|
39
|
-
## 0.3.0
|
|
40
|
-
|
|
41
|
-
### Minor Changes
|
|
42
|
-
|
|
43
|
-
- Suite registrars take a scenario, `(expect) => Effect`, instead of a bare Effect, and each case registers as a generator test, so the check a case ends in comes from the test's own `expect`. Kernel-explored cases re-provide the test's check ledger through `captureRunBinding`, so every seeded replay is judged once.
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- Updated dependencies:
|
|
48
|
-
- @systemfsoftware/vitest@0.1.0
|
|
49
|
-
|
|
50
|
-
## 0.2.0
|
|
51
|
-
|
|
52
|
-
### Minor Changes
|
|
53
|
-
|
|
54
|
-
- Requires `@systemfsoftware/vitest` installed under the `@effect/vitest` name (`"@effect/vitest": "npm:@systemfsoftware/vitest"`) in place of the upstream package. `TaskRef` reads the running test's context in property tests as well as in case tests.
|
|
55
|
-
|
|
56
|
-
## 0.1.1
|
|
57
|
-
|
|
58
|
-
### Patch Changes
|
|
59
|
-
|
|
60
|
-
- Update peer and runtime dependency on `effect` and companion packages to `4.0.0-rc.117`.
|
|
61
|
-
|
|
62
|
-
## 0.1.0
|
|
63
|
-
|
|
64
|
-
### Minor Changes
|
|
65
|
-
|
|
66
|
-
- `Suite`, `Register` and `TaskRef` functions that took their subject first can now also be called data-last. Existing calls keep working.
|
|
67
|
-
|
|
68
|
-
## 0.0.0
|
|
69
|
-
|
|
70
|
-
### Minor Changes
|
|
71
|
-
|
|
72
|
-
- New package: the registration core behind Effect spec suites.
|
|
73
|
-
|
|
74
|
-
`Suite.open`, `Suite.openShared`, `Suite.openCase`, and `Suite.openSharedCase` register a suite with no layer, a shared suite layer, a per-case layer, or both — a shared layer is acquired once per suite, a per-case layer is finalized around every case. Each takes a register mode (`run`, `skip`, `only`), a describe collector (`describe`, `skip`, `only`), and a live-clock flag selecting between test-clock and live-clock case runners. The error and case-body types are parameters of the suite, so a consumer declares its own error union and case shape. Each open also passes the suite's runner to `use` — services included for layered opens.
|
|
75
|
-
|
|
76
|
-
`TaskRef.RawVitestTaskRef` passes the running test's context to the case body as the runner provided it, callable included; `TaskRef.VitestTaskRef` carries it only when it is a plain object.
|
|
5
|
+
Published declaration files no longer carry the rolldown-plugin-dts patch; they come from rolldown-plugin-dts 0.28.8, which includes the same fix upstream.
|
package/README.md
CHANGED
|
@@ -13,9 +13,13 @@ import { Effect } from 'effect'
|
|
|
13
13
|
|
|
14
14
|
`KernelCase.caseProgram(body, env)` builds a case whose layers are rebuilt fresh around every run and whose body runs under the kernel's test clock; `KernelCase.liveCase(body, env, reason)` is the live-clock counterpart and announces the reason on the run report, so every live case is listed with why it stayed live.
|
|
15
15
|
|
|
16
|
+
`KernelCase.explore(program)` runs the baseline (the zero-preemption schedule), then the profile's seeded schedules — 250 at `per-change`, 25 at `local` — but only when the baseline had a choice point, an explored step with more than one runnable task. A baseline without one has a single schedule, so the case runs once. `KernelCase.exploreOnce(program)` runs the case once with no seeds: the decision path `CONFORMANCE_REPLAY` names, else the baseline.
|
|
17
|
+
|
|
18
|
+
A registered explored case runs `explore` first and `exploreOnce` as the fork's leak-check second run, on a fresh build. A passing case therefore costs 2 kernel runs without a choice point and 252 with one at `per-change`, and state the first run leaves behind still fails the second as `LeakedState`.
|
|
19
|
+
|
|
16
20
|
## Suite
|
|
17
21
|
|
|
18
|
-
`Suite.open` registers a suite with no layer, `Suite.openShared` adds a layer shared by the whole suite, `Suite.openCase` adds a layer acquired fresh around every case, and `Suite.openSharedCase` does both:
|
|
22
|
+
`Suite.open` registers a suite with no layer, `Suite.openShared` adds a layer shared by the whole suite, `Suite.openCase` adds a layer acquired fresh around every case, and `Suite.openSharedCase` does both. The shared layer is built once, by the first case that runs, every case of the suite sees those same services, and they are released when the suite ends; state a case must not share belongs in the case layer:
|
|
19
23
|
|
|
20
24
|
```ts
|
|
21
25
|
Suite.openShared(bindings, config, { layer: DatabaseFixture }, (register) => {
|
|
@@ -39,7 +43,7 @@ Suite.openShared(bindings, config, { layer: DatabaseFixture }, (register) => {
|
|
|
39
43
|
- Each entry point hands `use` a registrar (`Suite.RegisterFn<B, E, R>`); the registrar's body and error channels are yours to declare, and its requirement channel is the union of the layer services it hands you. A shared layer is acquired once for the whole suite; a per-case layer is acquired and finalized around every case.
|
|
40
44
|
- `register` mode is `Suite.RegisterMode` (`'run' | 'skip' | 'only'`).
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
An explored case's kernel run re-provides the test's binding onto the program (so the checks the kernel runs count for this test), scopes the run, and reports a failure with its seed and decision path. Its second run takes the same path through `KernelCase.exploreOnce`.
|
|
43
47
|
|
|
44
48
|
## TaskRef
|
|
45
49
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Context, Effect, Layer } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, Scope } from "effect";
|
|
2
2
|
import { Expect, Vitest } from "@systemfsoftware/vitest";
|
|
3
3
|
import { Asserted } from "@systemfsoftware/vitest/integration";
|
|
4
4
|
import { TestOptions } from "vitest";
|
|
5
|
-
import * as Scope from "effect/Scope";
|
|
5
|
+
import * as Scope$1 from "effect/Scope";
|
|
6
6
|
declare namespace KernelCase_d_exports {
|
|
7
|
-
export { LiveCase, announceLive, caseProgram, explore, liveCase };
|
|
7
|
+
export { LiveCase, announceLive, caseProgram, explore, exploreOnce, liveCase };
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* The live declaration a case carries instead of the `liveClock` boolean
|
|
@@ -20,8 +20,8 @@ interface LiveCase {
|
|
|
20
20
|
* zero-preemption schedule), the scenario body runs after it.
|
|
21
21
|
*/
|
|
22
22
|
declare const caseProgram: {
|
|
23
|
-
<B, E, R, RIn extends Scope.Scope>(env: Layer.Layer<R, never, RIn>): (body: Effect.Effect<B, E, R | RIn | Scope.Scope>) => Effect.Effect<B, E>;
|
|
24
|
-
<B, E, R, RIn extends Scope.Scope>(body: Effect.Effect<B, E, R | RIn | Scope.Scope>, env: Layer.Layer<R, never, RIn>): Effect.Effect<B, E>;
|
|
23
|
+
<B, E, R, RIn extends Scope$1.Scope>(env: Layer.Layer<R, never, RIn>): (body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>) => Effect.Effect<B, E>;
|
|
24
|
+
<B, E, R, RIn extends Scope$1.Scope>(body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>, env: Layer.Layer<R, never, RIn>): Effect.Effect<B, E>;
|
|
25
25
|
};
|
|
26
26
|
/** Announces a live case with its reason, which is how the run report lists it. */
|
|
27
27
|
declare const announceLive: (reason: string) => Effect.Effect<void>;
|
|
@@ -31,46 +31,16 @@ declare const announceLive: (reason: string) => Effect.Effect<void>;
|
|
|
31
31
|
* provides the case scope.
|
|
32
32
|
*/
|
|
33
33
|
declare const liveCase: {
|
|
34
|
-
<B, E, R, RIn extends Scope.Scope>(env: Layer.Layer<R, never, RIn>, reason: string): (body: Effect.Effect<B, E, R | RIn | Scope.Scope>) => Effect.Effect<B, E, Scope.Scope>;
|
|
35
|
-
<B, E, R, RIn extends Scope.Scope>(body: Effect.Effect<B, E, R | RIn | Scope.Scope>, env: Layer.Layer<R, never, RIn>, reason: string): Effect.Effect<B, E, Scope.Scope>;
|
|
34
|
+
<B, E, R, RIn extends Scope$1.Scope>(env: Layer.Layer<R, never, RIn>, reason: string): (body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>) => Effect.Effect<B, E, Scope$1.Scope>;
|
|
35
|
+
<B, E, R, RIn extends Scope$1.Scope>(body: Effect.Effect<B, E, R | RIn | Scope$1.Scope>, env: Layer.Layer<R, never, RIn>, reason: string): Effect.Effect<B, E, Scope$1.Scope>;
|
|
36
36
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Runs one case's program under the kernel: the direct order first, then the
|
|
39
|
-
* profile's seeded PCT schedules at the profile depth. A failure reports its
|
|
40
|
-
* seed and decision path, which `CONFORMANCE_REPLAY` reproduces.
|
|
41
|
-
*/
|
|
42
37
|
declare const explore: <A, E>(program: Effect.Effect<A, E>) => Promise<void>;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
/** An explored case's leak-check second run: its first run already took every seeded schedule. */
|
|
39
|
+
declare const exploreOnce: <A, E>(program: Effect.Effect<A, E>) => Promise<void>;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/Register.d.ts
|
|
46
42
|
type RegisterMode = 'run' | 'skip' | 'only';
|
|
47
43
|
type DescribeMode = 'describe' | 'skip' | 'only';
|
|
48
|
-
/**
|
|
49
|
-
* Keeps the caller's suite options verbatim when present; a suite declared
|
|
50
|
-
* without options is registered through the two-argument collector call.
|
|
51
|
-
*/
|
|
52
|
-
declare const invokeDescribe: {
|
|
53
|
-
(mode: DescribeMode, suiteName: string, suiteOpts: Options | undefined): (fn: () => void) => void;
|
|
54
|
-
(mode: DescribeMode, suiteName: string, suiteOpts: Options | undefined, fn: () => void): void;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* An explored case has no wall-clock limit: every run is bounded in steps, and
|
|
58
|
-
* the kernel reports a hang (deadlock, runaway, or a wait it cannot observe)
|
|
59
|
-
* deterministically. A timer would only measure how busy the machine is.
|
|
60
|
-
*/
|
|
61
|
-
declare const UNTIMED: {
|
|
62
|
-
readonly timeout: 0;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* One case's program under the kernel: the test's binding is re-provided onto it (the kernel
|
|
66
|
-
* drives it in its own run, so the check ledger and the running Vitest task are handed over), the
|
|
67
|
-
* run is scoped, and a failure reports its seed and decision path.
|
|
68
|
-
*/
|
|
69
|
-
declare const exploredProgram: <A, E>(program: Effect.Effect<A, E, Scope.Scope>) => Effect.Effect<void, E, Asserted>;
|
|
70
|
-
declare const selectCaseRunner: {
|
|
71
|
-
(mode: RegisterMode, live: LiveCase | undefined): (methodsIt: Vitest.Methods) => Vitest.Test<Scope.Scope>;
|
|
72
|
-
(methodsIt: Vitest.Methods, mode: RegisterMode, live: LiveCase | undefined): Vitest.Test<Scope.Scope>;
|
|
73
|
-
};
|
|
74
44
|
declare namespace Suite_d_exports {
|
|
75
45
|
export { Bindings, Config$1 as Config, DescribeMode, LiveCase, Options, RegisterFn, RegisterMode, Scenario, Shared, open, openCase, openShared, openSharedCase };
|
|
76
46
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { Kernel } from "@systemfsoftware/effect-sim-kernel";
|
|
3
3
|
import { createSpanRecorder, providedWorkspaceRoot, replayOfText, testIdentityOf, throwFailureRecord } from "@systemfsoftware/vitest/failure";
|
|
4
|
-
import { Cause, Config, Context, Effect, Exit, Layer, Match, Option, Schema } from "effect";
|
|
4
|
+
import { Cause, Config, Context, Effect, Exit, Layer, Match, Option, Schema, Scope } from "effect";
|
|
5
5
|
import { dual } from "effect/Function";
|
|
6
6
|
import { VitestTestContext, vitestTestContextKey } from "@systemfsoftware/vitest";
|
|
7
7
|
import { captureRunBinding } from "@systemfsoftware/vitest/integration";
|
|
8
|
-
import { describe } from "vitest";
|
|
8
|
+
import { afterAll, describe } from "vitest";
|
|
9
9
|
//#region src/KernelFailure.schema.ts
|
|
10
10
|
/**
|
|
11
11
|
* The kernel's own failure — a deadlock, an escape, a wait it cannot observe, or a runaway run — as a failure
|
|
@@ -42,6 +42,7 @@ var KernelCase_exports = /* @__PURE__ */ __exportAll({
|
|
|
42
42
|
announceLive: () => announceLive,
|
|
43
43
|
caseProgram: () => caseProgram,
|
|
44
44
|
explore: () => explore,
|
|
45
|
+
exploreOnce: () => exploreOnce,
|
|
45
46
|
liveCase: () => liveCase
|
|
46
47
|
});
|
|
47
48
|
/**
|
|
@@ -130,14 +131,7 @@ const throwIfExitFailed = (observed, schedule, recorder) => {
|
|
|
130
131
|
if (Exit.isFailure(observed.exit)) throwExitFailure(observed.exit, schedule, recorder);
|
|
131
132
|
};
|
|
132
133
|
const throwIfFailed = (observed, schedule, recorder) => Match.value(observed).pipe(Match.when(isKernelFailure, (failed) => throwKernelFailure(failed.failure, schedule, recorder)), Match.orElse((completed) => throwIfExitFailed(completed, schedule, recorder)));
|
|
133
|
-
const
|
|
134
|
-
fibers: new Set(baseline.steps.map((step) => step.fiberId)).size,
|
|
135
|
-
steps: baseline.steps.length
|
|
136
|
-
});
|
|
137
|
-
const budgetOf = (survey) => Effect.runPromise(Kernel.currentSeedsFor({
|
|
138
|
-
fibers: survey.fibers,
|
|
139
|
-
steps: survey.steps
|
|
140
|
-
}));
|
|
134
|
+
const budgetOf = (baseline) => Effect.runPromise(Kernel.currentSeedsFor(baseline));
|
|
141
135
|
const seedList = (count) => Array.from({ length: count }, (_entry, seed) => seed);
|
|
142
136
|
const seedsToRun = (seed, budget) => {
|
|
143
137
|
if (seed === void 0) return seedList(budget);
|
|
@@ -174,27 +168,30 @@ const runSeeds = (program, seeds, at, steps) => {
|
|
|
174
168
|
return runSeeds(program, seeds, at + 1, steps);
|
|
175
169
|
});
|
|
176
170
|
};
|
|
177
|
-
const
|
|
178
|
-
const
|
|
171
|
+
const stepBoundOf = (baseline) => Kernel.PctStepCount.make(baseline.decisions.length);
|
|
172
|
+
const seededRuns = (program, seed, baseline) => budgetOf(baseline).then((budget) => runSeeds(program, seedsToRun(seed, budget), 0, stepBoundOf(baseline)));
|
|
173
|
+
const baselineRun = (program) => {
|
|
179
174
|
const run = recorded(program);
|
|
180
175
|
return Kernel.run(run.program, { explore: "body" }).then((baseline) => {
|
|
181
176
|
throwIfFailed(baseline, {
|
|
182
177
|
seed: void 0,
|
|
183
178
|
decisions: baseline.decisions
|
|
184
179
|
}, run.recorder);
|
|
185
|
-
return
|
|
180
|
+
return baseline;
|
|
186
181
|
});
|
|
187
182
|
};
|
|
183
|
+
const baselineThen = (program, seed) => baselineRun(program).then((baseline) => seededRuns(program, seed, baseline));
|
|
188
184
|
const replayOrSeeded = (program, replay) => replay.path.length > 0 ? replayRun(program, replay, replay.path) : baselineThen(program, replay.seed);
|
|
189
|
-
|
|
190
|
-
* Runs one case's program under the kernel: the direct order first, then the
|
|
191
|
-
* profile's seeded PCT schedules at the profile depth. A failure reports its
|
|
192
|
-
* seed and decision path, which `CONFORMANCE_REPLAY` reproduces.
|
|
193
|
-
*/
|
|
185
|
+
const replayOrBaseline = (program, replay) => replay.path.length > 0 ? replayRun(program, replay, replay.path) : baselineRun(program).then(() => {});
|
|
194
186
|
const explore = (program) => readReplayValue().then((value) => {
|
|
195
187
|
if (value === void 0) return baselineThen(program, void 0);
|
|
196
188
|
return replayOrSeeded(program, replayOfText(value));
|
|
197
189
|
});
|
|
190
|
+
/** An explored case's leak-check second run: its first run already took every seeded schedule. */
|
|
191
|
+
const exploreOnce = (program) => readReplayValue().then((value) => {
|
|
192
|
+
if (value === void 0) return baselineRun(program).then(() => {});
|
|
193
|
+
return replayOrBaseline(program, replayOfText(value));
|
|
194
|
+
});
|
|
198
195
|
//#endregion
|
|
199
196
|
//#region src/Register.ts
|
|
200
197
|
const selectDescribe = (mode) => ({
|
|
@@ -249,10 +246,12 @@ const UNTIMED = { timeout: 0 };
|
|
|
249
246
|
* drives it in its own run, so the check ledger and the running Vitest task are handed over), the
|
|
250
247
|
* run is scoped, and a failure reports its seed and decision path.
|
|
251
248
|
*/
|
|
252
|
-
const
|
|
249
|
+
const exploredWith = (explorer, program) => Effect.gen(function* () {
|
|
253
250
|
const bound = (yield* captureRunBinding).bind(program);
|
|
254
|
-
return yield* Effect.promise(() => bound.pipe(scopedBody,
|
|
251
|
+
return yield* Effect.promise(() => bound.pipe(scopedBody, explorer));
|
|
255
252
|
});
|
|
253
|
+
const exploredProgram = (program) => exploredWith(explore, program);
|
|
254
|
+
const exploredOnceProgram = (program) => exploredWith(exploreOnce, program);
|
|
256
255
|
/**
|
|
257
256
|
* A live-declared case runs on the live clock as before; a case without a
|
|
258
257
|
* live declaration runs under the kernel, exploring the profile's schedules
|
|
@@ -284,24 +283,27 @@ const caseProgramOf = (scenario, env, live, binding) => (expect) => {
|
|
|
284
283
|
/**
|
|
285
284
|
* The fork's generator body for one case: it hands the callback's `expect` to the scenario, hands
|
|
286
285
|
* the running Vitest task to the step annotations, and runs the program the case declared — under
|
|
287
|
-
* the kernel
|
|
286
|
+
* the kernel through `explorer`, or on the live clock.
|
|
288
287
|
*/
|
|
289
|
-
const caseBody = (scenario, env, live) => function* ({ expect }) {
|
|
288
|
+
const caseBody = (scenario, env, live, explorer) => function* ({ expect }) {
|
|
290
289
|
const ctx = yield* VitestTestContext;
|
|
291
290
|
const binding = yield* captureRunBinding;
|
|
292
291
|
const program = provideTaskRef(caseProgramOf(scenario, env, live, binding)(expect), ctx);
|
|
293
292
|
if (live === void 0) {
|
|
294
|
-
yield*
|
|
293
|
+
yield* explorer(program);
|
|
295
294
|
return;
|
|
296
295
|
}
|
|
297
296
|
yield* program;
|
|
298
297
|
};
|
|
299
298
|
const registerCase = (register, name, scenario, env, live) => {
|
|
300
299
|
if (live === void 0) {
|
|
301
|
-
register(name, caseBody(scenario, env, live),
|
|
300
|
+
register(name, caseBody(scenario, env, live, exploredProgram), {
|
|
301
|
+
...UNTIMED,
|
|
302
|
+
rerun: caseBody(scenario, env, live, exploredOnceProgram)
|
|
303
|
+
});
|
|
302
304
|
return;
|
|
303
305
|
}
|
|
304
|
-
register(name, caseBody(scenario, env, live));
|
|
306
|
+
register(name, caseBody(scenario, env, live, exploredProgram));
|
|
305
307
|
};
|
|
306
308
|
const registrarFor = (methodsIt, config, env) => (name, scenario, mode, caseLive) => {
|
|
307
309
|
const live = caseLive ?? config.live;
|
|
@@ -313,9 +315,20 @@ const openImpl = (bindings, config, use) => {
|
|
|
313
315
|
});
|
|
314
316
|
};
|
|
315
317
|
const open = dual(3, openImpl);
|
|
318
|
+
/**
|
|
319
|
+
* The suite's layer, built once by the first case that needs it and released when the suite
|
|
320
|
+
* ends, so every case of the suite sees the same services. The build runs on its own root
|
|
321
|
+
* fiber: the first case's fiber ends with that case, and the suite's resources must not.
|
|
322
|
+
*/
|
|
323
|
+
const suiteLayerOf = (shared) => {
|
|
324
|
+
const scope = Scope.makeUnsafe();
|
|
325
|
+
const built = Effect.runSync(Effect.cached(Effect.flatten(Effect.promise(() => Effect.runPromiseExit(Layer.buildWithScope(shared.layer, scope))))));
|
|
326
|
+
afterAll(() => Effect.runPromise(Scope.close(scope, Exit.void)), UNTIMED.timeout);
|
|
327
|
+
return Layer.unwrap(Effect.map(built, Layer.succeedContext));
|
|
328
|
+
};
|
|
316
329
|
const openSharedImpl = (bindings, config, shared, use) => {
|
|
317
330
|
invokeDescribe(config.describe, config.name, config.options, () => {
|
|
318
|
-
use(registrarFor(bindings.it, config,
|
|
331
|
+
use(registrarFor(bindings.it, config, suiteLayerOf(shared)), bindings.it);
|
|
319
332
|
});
|
|
320
333
|
};
|
|
321
334
|
const openShared = dual(4, openSharedImpl);
|
|
@@ -327,7 +340,7 @@ const openCaseImpl = (bindings, config, caseLayer, use) => {
|
|
|
327
340
|
const openCase = dual(4, openCaseImpl);
|
|
328
341
|
const openSharedCaseImpl = (bindings, config, shared, caseLayer, use) => {
|
|
329
342
|
invokeDescribe(config.describe, config.name, config.options, () => {
|
|
330
|
-
use(registrarFor(bindings.it, config, Layer.fresh(caseLayer).pipe(Layer.provideMerge(shared
|
|
343
|
+
use(registrarFor(bindings.it, config, Layer.fresh(caseLayer).pipe(Layer.provideMerge(suiteLayerOf(shared)))), bindings.it);
|
|
331
344
|
});
|
|
332
345
|
};
|
|
333
346
|
const openSharedCase = dual(5, openSharedCaseImpl);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/effect-spec-runtime",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.5",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,36 +32,29 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@systemfsoftware/effect-sim-kernel": "^
|
|
35
|
+
"@systemfsoftware/effect-sim-kernel": "^2.0.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@microsoft/api-extractor": "^7.59.
|
|
38
|
+
"@microsoft/api-extractor": "^7.59.4",
|
|
39
39
|
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
40
|
-
"@systemfsoftware/oxlint-config-recommended": "^
|
|
41
|
-
"@systemfsoftware/
|
|
42
|
-
"@systemfsoftware/
|
|
43
|
-
"@systemfsoftware/
|
|
44
|
-
"@systemfsoftware/
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
50
|
-
"@systemfsoftware/vitest": "^2.0.0",
|
|
51
|
-
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
52
|
-
"@types/node": "^26",
|
|
53
|
-
"effect": "^4",
|
|
54
|
-
"fast-check": "^4",
|
|
55
|
-
"oxlint": "~1.82.0",
|
|
40
|
+
"@systemfsoftware/oxlint-config-recommended": "^6.0.1",
|
|
41
|
+
"@systemfsoftware/tsconfig": "^2.1.0",
|
|
42
|
+
"@systemfsoftware/tsdown-config": "^0.1.2",
|
|
43
|
+
"@systemfsoftware/vitest": "^4.1.1",
|
|
44
|
+
"@systemfsoftware/vitest-config": "^0.1.3",
|
|
45
|
+
"@types/node": "^26.6.5",
|
|
46
|
+
"effect": "^4.1.2",
|
|
47
|
+
"fast-check": "^4.10.2",
|
|
48
|
+
"oxlint": "~1.89.0",
|
|
56
49
|
"rimraf": "^6.1.3",
|
|
57
50
|
"tsdown": "^0.23.0",
|
|
58
51
|
"tstyche": "^7.2.5",
|
|
59
|
-
"vitest": "^5"
|
|
52
|
+
"vitest": "^5.1.0"
|
|
60
53
|
},
|
|
61
54
|
"peerDependencies": {
|
|
62
|
-
"@systemfsoftware/vitest": "^
|
|
63
|
-
"effect": "^4",
|
|
64
|
-
"vitest": "^5"
|
|
55
|
+
"@systemfsoftware/vitest": "^4.1.1",
|
|
56
|
+
"effect": "^4.1.2",
|
|
57
|
+
"vitest": "^5.1.0"
|
|
65
58
|
},
|
|
66
59
|
"publishConfig": {
|
|
67
60
|
"access": "public",
|
|
@@ -72,7 +65,6 @@
|
|
|
72
65
|
"build": "tsdown -l warn && pnpm api:check",
|
|
73
66
|
"typecheck": "tsc -b",
|
|
74
67
|
"test": "vitest run",
|
|
75
|
-
"mutation": "stryker run",
|
|
76
68
|
"test:types": "TSTYCHE_TYPESCRIPT_MODULE=tstyche-typescript tstyche",
|
|
77
69
|
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
|
|
78
70
|
"attw": "attw --pack .",
|