export declare const getNumberRange: (input: { start: number; end: number; }) => number[]; type TestContextShape = Record | void; type TestInputWithReason | void> = [ string, { because: string; }, (context: TContext) => Promise | void ]; type TestInputWithoutReason | void> = [string, (context: TContext) => Promise | void] | [string]; type TestInput = TestInputWithReason | TestInputWithoutReason; /** * .what = type helper to forbid async callbacks * .why = async describe callbacks break describeStack registration (stack pops before async body runs) */ type SyncCallback = F extends () => Promise ? never : F; interface Describe { void>(desc: string, fn: SyncCallback): void; /** Only runs the tests inside this `describe` for the current file */ only: void>(desc: string, fn: SyncCallback) => void; /** Skip the tests inside this `describe` for the current file */ skip: void>(desc: string, fn: SyncCallback) => void; /** Skip the tests inside this `describe` for the current file if the condition is satisfied */ skipIf: (condition: boolean) => void>(desc: string, fn: SyncCallback) => void; /** Runs the tests inside this `describe` for the current file only if the condition is satisfied */ runIf: (condition: boolean) => void>(desc: string, fn: SyncCallback) => void; /** * runs the describe block repeatedly to evaluate repeatability * * note * - provides `attempt` as direct value (fixed at registration time per describe block) * - for EVERY: N describe blocks registered, all must pass * - for SOME: N describe blocks registered, subsequent attempts skipped on success * * @example * given.repeatably({ attempts: 3, criteria: 'SOME' })('scene', ({ attempt }) => { * then('test', () => { * expect(attempt).toBeLessThanOrEqual(3); * }); * }); */ repeatably: (configuration: { /** * how many attempts to run the describe block, repeatedly */ attempts: number; /** * the criteria for the whole describe suite * * note * - EVERY = every attempt must pass for the suite to pass (default) * - SOME = some attempt must pass for the suite to pass (skips subsequent on success) */ criteria?: 'EVERY' | 'SOME'; }) => void>(desc: string, fn: SyncCallback) => void; } interface Test { (...input: TestInput): void; /** Only runs this test for the current file */ only: (...input: TestInput) => void; /** Skip this test */ skip: (...input: TestInput) => void; /** Marks the test as one that still needs to be written */ todo: (...input: TestInput) => void; /** Skip the test if the condition is satisfied */ skipIf: (condition: boolean) => (...input: TestInput) => void; /** Runs the test if the condition is satisfied */ runIf: (condition: boolean) => (...input: TestInput) => void; /** Runs the test repeatedly to evaluate repeatability */ repeatably: (configuration: { /** * how many attempts to run the test, repeatedly */ attempts: number; /** * the criteria for the whole test suite * * note * - EVERY = every test must pass for the suite to pass * - SOME = some test must pass for the suite to pass */ criteria: 'EVERY' | 'SOME'; }) => (...input: TestInput<{ attempt: number; }>) => void; } /** * describe the scene (initial state or context) for a group of tests * @example * given('a dry plant', () => { * when('water needs are checked', () => { * then('it should return true', () => { * expect(doesPlantNeedWater(plant)).toBe(true); * }); * }); * }); */ export declare const given: Describe; /** * describe the event (action or trigger) that occurs within a scene * @example * when('the user clicks submit', () => { * then('the form should be submitted', () => { * expect(form.submitted).toBe(true); * }); * }); */ export declare const when: Describe; /** * .what = namespace object for BDD-style test helpers * .why = provides vitest-compatible access to given/when/then via `bdd.then()` * since direct `then` export triggers ESM thenable detection in vitest. * * @see .agent/repo=.this/role=any/briefs/limitation.esm-thenable-then-export.md */ export declare const bdd: { given: Describe; when: Describe; then: Test; }; /** * .what = wraps `then` to handle vitest's thenable detection * .why = vitest calls `then(resolve, reject)` on module import; we detect and resolve it * * @see .agent/repo=.this/role=any/briefs/limitation.esm-thenable-then-export.md */ declare const thenExportable: Test; export { thenExportable as then };