Interface for synchronous property defining hooks, see IProperty

Since 2.2.0

interface IPropertyWithHooks<Ts> {
    runAfterEach?: () => void;
    runBeforeEach?: () => void;
    afterEach(
        invalidHookFunction: (
            hookFunction: GlobalPropertyHookFunction,
        ) => Promise<unknown>,
    ): "afterEach expects a synchronous function but was given a function returning a Promise";
    afterEach(hookFunction: PropertyHookFunction): IPropertyWithHooks<Ts>;
    beforeEach(
        invalidHookFunction: (
            hookFunction: GlobalPropertyHookFunction,
        ) => Promise<unknown>,
    ): "beforeEach expects a synchronous function but was given a function returning a Promise";
    beforeEach(hookFunction: PropertyHookFunction): IPropertyWithHooks<Ts>;
    generate(mrng: Random, runId?: number): Value<Ts>;
    isAsync(): false;
    run(
        v: Ts,
        dontRunHook?: boolean,
    ): null | PreconditionFailure | PropertyFailure;
    shrink(value: Value<Ts>): Stream<Value<Ts>>;
}

Type Parameters

  • Ts

Hierarchy (View Summary)

Properties

runAfterEach?: () => void

Run after each hook

Since 3.4.0

runBeforeEach?: () => void

Run before each hook

Since 3.4.0

Methods