UNPKG

@fast-check/vitest

Version:

Property based testing for Vitest based on fast-check

15 lines (14 loc) 845 B
import type { Parameters as FcParameters } from 'fast-check'; import type { ArbitraryTuple, Prop, ArbitraryRecord, PropRecord, FcExtra } from './types.js'; /** * Revamped {it,test} with added `.prop` */ export type FastCheckItBuilder<T> = T & ('each' extends keyof T ? T & { prop: <Ts, TsParameters extends Ts = Ts>(arbitraries: Ts extends [any] | any[] ? ArbitraryTuple<Ts> : ArbitraryRecord<Ts>, params?: FcParameters<TsParameters>) => (testName: string, prop: Ts extends [any] | any[] ? Prop<Ts> : PropRecord<Ts>, timeout?: number) => void; } : T) & { [K in keyof Omit<T, 'each'>]: FastCheckItBuilder<T[K]>; }; /** * Build the enriched version of {it,test}, the one with added `.prop` */ export declare function buildTest<T extends (...args: any[]) => any>(testFn: T, fc: FcExtra, ancestors?: Set<string>): FastCheckItBuilder<T>;