@systemfsoftware/effect-spec-runtime 1.1.5 → 1.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 +2 -2
- package/dist/index.d.ts +25 -4
- package/dist/index.mjs +25 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @systemfsoftware/effect-spec-runtime
|
|
2
2
|
|
|
3
|
-
# @systemfsoftware/effect-spec-runtime@1.
|
|
3
|
+
# @systemfsoftware/effect-spec-runtime@1.3.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Adds `SpanRecorder`, a tracer that keeps every span a program opens, in the order they began. It is the span harness for a package below `@systemfsoftware/trace-spec` in the dependency graph whose published behaviour is the spans it emits. Use `SpanRecorder.make()` and run the program under `Effect.withTracer(program, recorder.tracer)`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Scope } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, Scope, Tracer } from "effect";
|
|
2
2
|
import { Expect, Vitest } from "@systemfsoftware/vitest";
|
|
3
3
|
import { Asserted } from "@systemfsoftware/vitest/integration";
|
|
4
4
|
import { TestOptions } from "vitest";
|
|
@@ -37,12 +37,25 @@ declare const liveCase: {
|
|
|
37
37
|
declare const explore: <A, E>(program: Effect.Effect<A, E>) => Promise<void>;
|
|
38
38
|
/** An explored case's leak-check second run: its first run already took every seeded schedule. */
|
|
39
39
|
declare const exploreOnce: <A, E>(program: Effect.Effect<A, E>) => Promise<void>;
|
|
40
|
+
declare namespace SpanRecorder_d_exports {
|
|
41
|
+
export { SpanRecorder, make };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A tracer that keeps every span a program opens, in the order they began. It is the tracing harness for a package
|
|
45
|
+
* that sits below `@systemfsoftware/trace-spec` in the dependency graph and whose published behaviour is the spans
|
|
46
|
+
* it emits; every other package asserts spans through a trace suite.
|
|
47
|
+
*/
|
|
48
|
+
interface SpanRecorder {
|
|
49
|
+
readonly tracer: Tracer.Tracer;
|
|
50
|
+
readonly spans: ReadonlyArray<Tracer.NativeSpan>;
|
|
51
|
+
}
|
|
52
|
+
declare const make: () => SpanRecorder;
|
|
40
53
|
//#endregion
|
|
41
54
|
//#region src/Register.d.ts
|
|
42
55
|
type RegisterMode = 'run' | 'skip' | 'only';
|
|
43
56
|
type DescribeMode = 'describe' | 'skip' | 'only';
|
|
44
57
|
declare namespace Suite_d_exports {
|
|
45
|
-
export { Bindings, Config$1 as Config, DescribeMode, LiveCase, Options, RegisterFn, RegisterMode, Scenario, Shared, open, openCase, openShared, openSharedCase };
|
|
58
|
+
export { Bindings, CaseLive, Config$1 as Config, DescribeMode, LiveCase, Options, RegisterFn, RegisterMode, Scenario, Shared, open, openCase, openShared, openSharedCase };
|
|
46
59
|
}
|
|
47
60
|
type Options = Pick<TestOptions, 'tags'> & Partial<TestOptions>;
|
|
48
61
|
interface Bindings {
|
|
@@ -63,8 +76,16 @@ interface Shared<R> {
|
|
|
63
76
|
* provides; every marked step needs the runner's scope and check service beside it.
|
|
64
77
|
*/
|
|
65
78
|
type Scenario<B, E, R> = (expect: Expect) => Effect.Effect<B, E, R | Scope.Scope | Asserted>;
|
|
79
|
+
/**
|
|
80
|
+
* A case's own live declaration. A live case's first run may hang on an act that happens once, such
|
|
81
|
+
* as a person approving in a browser; `rerun` is then the scenario the second run on fresh services
|
|
82
|
+
* executes instead, so the check for state kept outside the layer still runs without that act.
|
|
83
|
+
*/
|
|
84
|
+
interface CaseLive<B, E, R> extends LiveCase {
|
|
85
|
+
readonly rerun?: Scenario<B, E, R>;
|
|
86
|
+
}
|
|
66
87
|
interface RegisterFn<B, E, R> {
|
|
67
|
-
(name: string, scenario: Scenario<B, E, R>, mode: RegisterMode, live?:
|
|
88
|
+
(name: string, scenario: Scenario<B, E, R>, mode: RegisterMode, live?: CaseLive<B, E, R>): void;
|
|
68
89
|
}
|
|
69
90
|
declare const open: {
|
|
70
91
|
<B, E, C>(config: Config$1, use: (register: RegisterFn<B, E, Scope.Scope>, propIt: Vitest.MethodsNonLive<never>) => C): (bindings: Bindings) => void;
|
|
@@ -102,4 +123,4 @@ declare const provideTaskRef: {
|
|
|
102
123
|
<A, E, R, Ctx>(effect: Effect.Effect<A, E, R>, ctx: Ctx): Effect.Effect<A, E, R>;
|
|
103
124
|
};
|
|
104
125
|
//#endregion
|
|
105
|
-
export { KernelCase_d_exports as KernelCase, Suite_d_exports as Suite, TaskRef_service_d_exports as TaskRef };
|
|
126
|
+
export { KernelCase_d_exports as KernelCase, SpanRecorder_d_exports as SpanRecorder, Suite_d_exports as Suite, TaskRef_service_d_exports as TaskRef };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, Scope } from "effect";
|
|
4
|
+
import { Cause, Config, Context, Effect, Exit, Layer, Match, Option, Schema, Scope, Tracer } 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";
|
|
@@ -193,6 +193,20 @@ const exploreOnce = (program) => readReplayValue().then((value) => {
|
|
|
193
193
|
return replayOrBaseline(program, replayOfText(value));
|
|
194
194
|
});
|
|
195
195
|
//#endregion
|
|
196
|
+
//#region src/SpanRecorder.ts
|
|
197
|
+
var SpanRecorder_exports = /* @__PURE__ */ __exportAll({ make: () => make });
|
|
198
|
+
const make = () => {
|
|
199
|
+
const spans = [];
|
|
200
|
+
return {
|
|
201
|
+
tracer: Tracer.make({ span: (options) => {
|
|
202
|
+
const span = new Tracer.NativeSpan(options);
|
|
203
|
+
spans.push(span);
|
|
204
|
+
return span;
|
|
205
|
+
} }),
|
|
206
|
+
spans
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
//#endregion
|
|
196
210
|
//#region src/Register.ts
|
|
197
211
|
const selectDescribe = (mode) => ({
|
|
198
212
|
skip: describe.skip,
|
|
@@ -295,6 +309,14 @@ const caseBody = (scenario, env, live, explorer) => function* ({ expect }) {
|
|
|
295
309
|
}
|
|
296
310
|
yield* program;
|
|
297
311
|
};
|
|
312
|
+
const registerLiveCase = (register, name, scenario, env, live) => {
|
|
313
|
+
const first = caseBody(scenario, env, live, exploredProgram);
|
|
314
|
+
if (live.rerun === void 0) {
|
|
315
|
+
register(name, first);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
register(name, first, { rerun: caseBody(live.rerun, env, live, exploredProgram) });
|
|
319
|
+
};
|
|
298
320
|
const registerCase = (register, name, scenario, env, live) => {
|
|
299
321
|
if (live === void 0) {
|
|
300
322
|
register(name, caseBody(scenario, env, live, exploredProgram), {
|
|
@@ -303,7 +325,7 @@ const registerCase = (register, name, scenario, env, live) => {
|
|
|
303
325
|
});
|
|
304
326
|
return;
|
|
305
327
|
}
|
|
306
|
-
register
|
|
328
|
+
registerLiveCase(register, name, scenario, env, live);
|
|
307
329
|
};
|
|
308
330
|
const registrarFor = (methodsIt, config, env) => (name, scenario, mode, caseLive) => {
|
|
309
331
|
const live = caseLive ?? config.live;
|
|
@@ -345,4 +367,4 @@ const openSharedCaseImpl = (bindings, config, shared, caseLayer, use) => {
|
|
|
345
367
|
};
|
|
346
368
|
const openSharedCase = dual(5, openSharedCaseImpl);
|
|
347
369
|
//#endregion
|
|
348
|
-
export { KernelCase_exports as KernelCase, Suite_exports as Suite, TaskRef_service_exports as TaskRef };
|
|
370
|
+
export { KernelCase_exports as KernelCase, SpanRecorder_exports as SpanRecorder, Suite_exports as Suite, TaskRef_service_exports as TaskRef };
|
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.3.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@microsoft/api-extractor": "^7.59.4",
|
|
39
39
|
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
40
|
-
"@systemfsoftware/oxlint-config-recommended": "^
|
|
40
|
+
"@systemfsoftware/oxlint-config-recommended": "^8.0.1",
|
|
41
41
|
"@systemfsoftware/tsconfig": "^2.1.0",
|
|
42
42
|
"@systemfsoftware/tsdown-config": "^0.1.2",
|
|
43
|
-
"@systemfsoftware/vitest": "^4.1.
|
|
43
|
+
"@systemfsoftware/vitest": "^4.1.2",
|
|
44
44
|
"@systemfsoftware/vitest-config": "^0.1.3",
|
|
45
45
|
"@types/node": "^26.6.5",
|
|
46
46
|
"effect": "^4.1.2",
|
|
47
47
|
"fast-check": "^4.10.2",
|
|
48
|
-
"oxlint": "~1.
|
|
48
|
+
"oxlint": "~1.93.0",
|
|
49
49
|
"rimraf": "^6.1.3",
|
|
50
50
|
"tsdown": "^0.23.0",
|
|
51
51
|
"tstyche": "^7.2.5",
|
|
52
52
|
"vitest": "^5.1.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@systemfsoftware/vitest": "^4.1.
|
|
55
|
+
"@systemfsoftware/vitest": "^4.1.2",
|
|
56
56
|
"effect": "^4.1.2",
|
|
57
57
|
"vitest": "^5.1.0"
|
|
58
58
|
},
|