import { Check, Expect, it, layer } from "@systemfsoftware/vitest"; import { Suite, TaskRef } from "@systemfsoftware/effect-spec-runtime"; import { Asserted } from "@systemfsoftware/vitest/integration"; import { Context, Duration, Effect, Layer, Schedule, Schema } from "effect"; import * as Effect$1 from "effect/Effect"; import * as Layer$1 from "effect/Layer"; import * as Result from "effect/Result"; import * as Scope from "effect/Scope"; //#endregion //#region src/StepError.schema.d.ts declare const StepError_base: Schema.Class, import("effect/Cause").YieldableError>; /** * Derives `message` from `keyword`, `text` and `cause`, so a step failure never prints an empty * headline. Declared as a getter because a `message` field would change the error's encoded shape. */ export declare class StepError extends StepError_base { get message(): string; } declare namespace SuiteScope_d_exports { export { ScopeIdentifiers$1 as ScopeIdentifiers, ScopeMap$1 as ScopeMap, ScopeServices$1 as ScopeServices, resolve }; } type AnyValue = A; type ScopeMap$1 = Readonly>>; type ScopeServices$1 = { readonly [K in keyof S]: S[K] extends Effect.Effect ? A : never; }; type ScopeIdentifiers$1 = { [K in keyof S]: S[K] extends Effect.Effect ? R : never; }[keyof S]; /** * Resolves every service named by the scope map at once, preserving the * record's shape and the union of the named requirements. */ declare function resolve(map: S): Effect.Effect, never, ScopeIdentifiers$1>; //#endregion //#region src/DoNotation.d.ts interface PollOptions { /** * The interval between poll attempts. * Default: '50 millis' */ readonly interval?: Duration.Input | undefined; /** * Maximum duration to wait before timing out and failing. * Default: '5 seconds' */ readonly timeout?: Duration.Input | undefined; } export declare const pollSchedule: (opts?: PollOptions) => Schedule.Schedule; /** * The test's own `expect`, published by the runner for the scenario it drives. A Then step body * receives it as its second parameter, so no step reaches for an import and no step can assert * outside the check the ledger sees. */ export declare const StepExpect: Context.Reference; /** * What a Then step body answers with: the one check of the state it observed, or an Effect that * answers with one — a body that must await something before it can check. */ type StepCheck = Check | Effect.Effect; type VitestTaskContext = TaskRef.VitestTaskContext; export declare const VitestTaskRef: Context.Reference | null>; type NoInfer$1 = [A][A extends A ? 0 : never]; declare const GherkinScopeTypeId: unique symbol; export declare const StageTypeId: unique symbol; type InitialStage = { readonly [StageTypeId]: 'initial'; }; type GivenStage = { readonly [StageTypeId]: 'given'; }; type WhenStage = { readonly [StageTypeId]: 'when'; }; type ThenStage = { readonly [StageTypeId]: 'then'; }; type Stage = InitialStage | GivenStage | WhenStage | ThenStage; export declare const stageInitial: InitialStage; export declare const stageGiven: GivenStage; export declare const stageWhen: WhenStage; export declare const stageThen: ThenStage; type GherkinScope = A & { readonly [GherkinScopeTypeId]: typeof GherkinScopeTypeId; }; type StepText = string | ((scope: A) => string); type GherkinEffect = Effect.Effect, E, R>; type AssertedPipeline = Effect.Effect, StepError, R>; /** * A Then/And/But body asserts the state the last Given or When produced, and that state is * asserted once: a second assertion step before the next Given or When is refused by name. */ type AssertionStateRefused = '✗ a second assertion step on the same state. Assert it once in one Then: Then(text)((s, expect) => expect({ a: s.a, b: s.b }).toEqual({...})).'; /** * The gate an assertion step's input carries. Its `[StageTypeId]` is a stage a Given or When * produced, so a pipeline already past its assertion mismatches with the refusal as the property's * type — the compile half of the one-state rule, with the runtime half on the ledger's refusal. */ type AssertableScope = { readonly [StageTypeId]?: InitialStage[typeof StageTypeId] | GivenStage[typeof StageTypeId] | WhenStage[typeof StageTypeId] | AssertionStateRefused; }; declare const _given: (text: StepText) => { (name: N, f: (a: NoInfer$1) => Effect.Effect): (self: GherkinEffect) => GherkinEffect & Record & GivenStage, E1 | StepError, R1 | R2 | Asserted>; (f: (a: NoInfer$1) => Effect.Effect | void): (self: GherkinEffect) => GherkinEffect & GivenStage, E1 | StepError, R1 | R2 | Asserted>; }; declare const _then: (text: StepText) => (f: (a: NoInfer$1, expect: Expect) => StepCheck) => (self: GherkinEffect & AssertableScope) => GherkinEffect & ThenStage, E1 | StepError, R1 | R2 | Asserted>; declare const _and: (text: StepText) => (f: (a: NoInfer$1, expect: Expect) => StepCheck) => (self: GherkinEffect & AssertableScope) => GherkinEffect & ThenStage, E1 | StepError, R1 | R2 | Asserted>; declare const _but: (text: StepText) => (f: (a: NoInfer$1, expect: Expect) => StepCheck) => (self: GherkinEffect & AssertableScope) => GherkinEffect & ThenStage, E1 | StepError, R1 | R2 | Asserted>; type ScopeMap = ScopeMap$1; type ScopeServices = ScopeServices$1; type ScopeIdentifiers = ScopeIdentifiers$1; declare function makeScope(map: S): GherkinEffect & GivenStage, never, ScopeIdentifiers>; export declare const Gherkin: { readonly Do: Effect.Effect, never, never>; readonly startWith: (bindings: A) => GherkinEffect; readonly scope: typeof makeScope; readonly Given: typeof _given; readonly When: ((text: StepText) => { (name: N, f: (a: NoInfer$1) => Effect.Effect): (self: GherkinEffect) => GherkinEffect & Record & WhenStage, E1 | StepError, R1 | R2 | Asserted>; (f: (a: NoInfer$1) => Effect.Effect | void): (self: GherkinEffect) => GherkinEffect & WhenStage, E1 | StepError, R1 | R2 | Asserted>; }) & { poll: (text: StepText, opts?: PollOptions) => { (name: N, f: (a: NoInfer$1) => Effect.Effect): (self: GherkinEffect) => GherkinEffect & Record & WhenStage, E1 | StepError, R1 | R2 | Asserted>; (f: (a: NoInfer$1) => Effect.Effect | void): (self: GherkinEffect) => GherkinEffect & WhenStage, E1 | StepError, R1 | R2 | Asserted>; }; }; readonly Then: typeof _then; readonly And: typeof _and; readonly But: typeof _but; }; export declare const Given: typeof _given, When: ((text: StepText) => { (name: N, f: (a: NoInfer$1) => Effect.Effect): (self: GherkinEffect) => GherkinEffect & Record & WhenStage, E1 | StepError, R1 | R2 | Asserted>; (f: (a: NoInfer$1) => Effect.Effect | void): (self: GherkinEffect) => GherkinEffect & WhenStage, E1 | StepError, R1 | R2 | Asserted>; }) & { poll: (text: StepText, opts?: PollOptions) => { (name: N, f: (a: NoInfer$1) => Effect.Effect): (self: GherkinEffect) => GherkinEffect & Record & WhenStage, E1 | StepError, R1 | R2 | Asserted>; (f: (a: NoInfer$1) => Effect.Effect | void): (self: GherkinEffect) => GherkinEffect & WhenStage, E1 | StepError, R1 | R2 | Asserted>; }; }, Then: typeof _then, And: typeof _and, But: typeof _but; //#endregion //#region src/extensions/Pairwise.d.ts type NoInfer = [A][A extends A ? 0 : never]; type PairwiseResult = { readonly a: A; readonly b: A; readonly aLabel: string; readonly bLabel: string; }; interface PairwiseMatrix { readonly a: { readonly name: string; readonly layer: Layer.Layer; }; readonly b: { readonly name: string; readonly layer: Layer.Layer; }; } export declare const pairwiseFor: { (service: Context.Service): (matrix: PairwiseMatrix) => (text: StepText) => (name: N, f: (scope: NoInfer) => (svc: Service) => Effect.Effect) => (self: GherkinEffect) => GherkinEffect & Record> & WhenStage, E1 | StepError, R1 | RA | RB | Asserted>; (matrix: PairwiseMatrix, service: Context.Service): (text: StepText) => (name: N, f: (scope: NoInfer) => (svc: Service) => Effect.Effect) => (self: GherkinEffect) => GherkinEffect & Record> & WhenStage, E1 | StepError, R1 | RA | RB | Asserted>; }; //#endregion //#region src/FeatureRuntime.d.ts type ScenarioOptions = { readonly scenarioLayer?: Layer$1.Layer; readonly layer?: Layer$1.Layer; readonly live?: string; }; type Top = T; type ScenarioBody = Effect$1.Effect; type BackgroundEffect = Effect$1.Effect; /** * A registered scenario: the runner's own `expect` arrives as the argument, so every assertion * step inside the scenario reaches the test's check callback rather than an import. `R` is what the * scenario's layer provides; every marked step also needs the runner's check service, so the run * carries `Asserted` beside it. */ type ScenarioRun = (expect: Expect) => Effect$1.Effect; /** * A scenario title names a concrete situation in natural-language prose. Two * shape checks keep DAMP `Should_[Behavior]_When_[Condition]` unit-test names — * and every concatenated-token title shaped like one — out of the call site: * 1. the literal must not start with `Should`; * 2. the literal must contain at least one ASCII space (a single-word title is * a test name, not prose). * Either check failing maps to `ScenarioTitleRejected`, so the call fails to * type-check with the rule in the diagnostic. Non-literal titles (widened * `string`) pass through untouched — a runtime guard would catch those, but * the brand is the contract this skill ships. */ type ScenarioTitleRejected = `Scenario titles are natural-language prose of a concrete situation, not DAMP Should_[Behavior]_When_[Condition] unit-test names. Got: ${T}` | `Scenario title must be natural-language prose (at least one space separates words); got: ${T}`; type ScenarioTitle = T extends `Should${string}` ? ScenarioTitleRejected : T extends `${string} ${string}` ? T : ScenarioTitleRejected; type OutlineCallable = { [], RPipe extends RShared | RFresh | RFreshReq | Scope.Scope | Asserted>(name: ScenarioTitle, examples: Rows, stepFactory: (row: Rows[number]) => Effect$1.Effect): void; [], RExtra, RPipe extends RShared | RFresh | RFreshReq | Scope.Scope | Asserted | RExtra>(name: ScenarioTitle, examples: Rows, stepFactory: (row: Rows[number]) => Effect$1.Effect, opts: ScenarioOptions): void; }; type OutlineFn = OutlineCallable & { readonly skip: OutlineCallable; readonly only: OutlineCallable; }; type HeadlessPipelineRejected = 'Scenario pipeline must conclude with at least one Then step, not end on Given or When'; type ValidScenarioPipeline

= P extends GherkinEffect ? S extends ThenStage ? P : HeadlessPipelineRejected : P; type ScenarioCallable = { >(name: ScenarioTitle, pipeline: P & ValidScenarioPipeline

): void; >(name: ScenarioTitle, opts: ScenarioOptions, pipeline: P & ValidScenarioPipeline

): void; }; type ScenarioFn = ScenarioCallable & { readonly skip: ScenarioCallable; readonly only: ScenarioCallable; }; type EmptyScopeMap$1 = Readonly>; type FeatureBody = (ctx: { readonly scenario: ScenarioFn; readonly background: (pipeline: BackgroundEffect) => void; readonly scenarioOutline: OutlineFn; readonly scope: GherkinEffect & GivenStage, never, ScopeIdentifiers>; readonly Do: Effect$1.Effect; }) => void; export declare const resolveScenarioArgs: { (third: Effect$1.Effect | undefined): (second: Effect$1.Effect | ScenarioOptions | undefined) => { pipeline: Effect$1.Effect; opts: ScenarioOptions | null; }; (second: Effect$1.Effect | ScenarioOptions | undefined, third: Effect$1.Effect | undefined): { pipeline: Effect$1.Effect; opts: ScenarioOptions | null; }; }; //#endregion //#region src/Feature.d.ts type EmptyScopeMap = Readonly>; type FeatureSuiteOptions = Suite.Options; type EffectVitestBindings = Suite.Bindings; type FeatureBuilderBoth = { readonly live: (reason: string) => FeatureBuilderBoth; body: (body: FeatureBody) => void; withScope: (map: S2) => FeatureBuilderBoth; }; type FeatureBuilderWithLayer = { readonly live: (reason: string) => FeatureBuilderWithLayer; body: (body: FeatureBody) => void; withScope: (map: S2) => FeatureBuilderWithLayer; withScenarioLayer: (layer: Layer$1.Layer) => FeatureBuilderBoth; }; type FeatureBuilderWithScenarioLayer = { readonly live: (reason: string) => FeatureBuilderWithScenarioLayer; body: (body: FeatureBody) => void; withLayer: (layer: Layer$1.Layer) => FeatureBuilderBoth; withScope: (map: S2) => FeatureBuilderWithScenarioLayer; }; type FeatureBuilder = { readonly live: (reason: string) => FeatureBuilder; body: (body: FeatureBody) => void; /** * Provide a shared fixture layer across all scenarios in this feature suite. * * Maps to Vitest's `worker` or file-level fixture scope. Resources acquired in this layer * are allocated once when the suite starts and released at suite completion. * * @example * ```ts * // Bridging a Vitest callback-based fixture: * const DatabaseFixture = Layer.scoped( * Database, * Effect.acquireRelease( * Effect.sync(() => createDatabase()), * (db) => Effect.sync(() => db.teardown()) * ) * ) * * Feature('User management').withLayer(DatabaseFixture) * ``` */ withLayer: (layer: Layer$1.Layer) => FeatureBuilderWithLayer; /** * Provide a per-scenario fresh fixture layer. * * Maps to Vitest's `test` fixture scope (`test.extend({ fixture: async ({}, use) => { ... use(val); cleanup(); } })`). * Resources are allocated fresh before each scenario and automatically torn down via their * `Scope` finalizer (`Effect.acquireRelease`) when the scenario completes, regardless of success or failure. * * @example * ```ts * const TempDirFixture = Layer.scoped( * TempDirectory, * Effect.acquireRelease( * Effect.sync(() => makeTempDir()), * (dir) => Effect.sync(() => removeTempDir(dir)) * ) * ) * * Feature('File processing').withScenarioLayer(TempDirFixture) * ``` */ withScenarioLayer: (layer: Layer$1.Layer) => FeatureBuilderWithScenarioLayer; withScope: (map: S2) => FeatureBuilder; }; type FeatureStarter = (suiteName: string, suiteOpts?: FeatureSuiteOptions) => FeatureBuilder; type FeatureFn = FeatureStarter & { readonly skip: FeatureStarter; readonly only: FeatureStarter; }; export declare const makeFeature: (deps: EffectVitestBindings) => FeatureFn; //#endregion //#region src/OutlineExpand.d.ts type TemplateToken = { tag: string; rest: string; }; export declare const tokenizeTemplate: (template: string) => readonly TemplateToken[]; interface OutlineRow { readonly row: Row; readonly title: string; } export declare const stringifyForTitle: (value: A) => string; type AnyRow = Record; export declare const renderTitle: { (row: AnyRow, stringify?: (value: V) => string): (template: string) => string; (template: string, row: AnyRow, stringify?: (value: V) => string): string; }; export declare const expandOutline: { (rows: readonly Row[], stringify?: (value: V) => string): (name: string) => Result.Result[], string>; (name: string, rows: readonly Row[], stringify?: (value: V) => string): Result.Result[], string>; }; //#endregion export { type AssertedPipeline, type AssertionStateRefused, type EffectVitestBindings, type FeatureBody, type FeatureBuilder, type FeatureBuilderBoth, type FeatureBuilderWithLayer, type FeatureBuilderWithScenarioLayer, type FeatureFn, type FeatureSuiteOptions, type GherkinEffect, type GherkinScope, type GivenStage, type HeadlessPipelineRejected, type InitialStage, type OutlineFn, type OutlineRow, type PairwiseMatrix, type PairwiseResult, type PollOptions, type ScenarioBody, type ScenarioFn, type ScenarioOptions, type ScenarioRun, type ScopeIdentifiers, type ScopeMap, type ScopeServices, type Stage, type StepCheck, type StepText, type TemplateToken, type ThenStage, type ValidScenarioPipeline, type VitestTaskContext, type WhenStage, it, layer };