Prelude API
    Preparing search index...

    Type Alias TraceOptions<Op>

    type TraceOptions<Op> = {
        fixed?: boolean;
        length: number | ((rng: Prng) => number);
        op: (rng: Prng, ops: readonly Op[]) => Op;
        run: (ops: readonly Op[]) => void | Promise<void>;
        seed: number;
        simplify?: (op: Op) => Op[];
        trials: number;
    }

    Type Parameters

    • Op
    Index
    fixed?: boolean

    Do not scale trials with SLOW_TESTS.

    length: number | ((rng: Prng) => number)

    Number of operations per trace, or a function choosing it per trial.

    op: (rng: Prng, ops: readonly Op[]) => Op

    Generates the next operation. ops are the operations generated so far in this trace. Operations must stay meaningful as any subsequence of the trace: shrinking replays subsets of them.

    run: (ops: readonly Op[]) => void | Promise<void>

    Replays a trace from a fresh state — structure and reference model — and throws at the first violated invariant or model disagreement.

    seed: number

    Base seed. Each trial derives its own generator from it, so a failure names seed and trial.

    simplify?: (op: Op) => Op[]

    Optional simpler candidates for a single operation, tried during shrinking.

    trials: number

    Number of traces to generate; multiplied by stressFactor unless fixed is set.