UNPKG

@fast-check/ava

Version:

Property based testing for AVA based on fast-check

18 lines (17 loc) 882 B
import test, { AfterFn, BeforeFn, ImplementationFn } from "ava"; import * as fc from "fast-check"; //#region src/ava-fast-check.d.ts type NonEmptyArray<A> = A[] & { 0: A; }; type ArbitraryTuple<Ts extends NonEmptyArray<any>> = { [P in keyof Ts]: fc.Arbitrary<Ts[P]> }; type Prop<Context, Ts extends NonEmptyArray<any>> = ImplementationFn<Ts, Context>; type PropertyTest<Context> = <Ts extends NonEmptyArray<any>>(label: string, arbitraries: ArbitraryTuple<Ts>, prop: Prop<Context, Ts>, params?: fc.Parameters<Ts>) => void; type AvaModifierWhitelist = "only" | "failing" | "skip" | "serial"; type PropertyTestFn<Context> = PropertyTest<Context> & { [Modifier in AvaModifierWhitelist]: PropertyTest<Context> } & { before: BeforeFn<Context>; after: AfterFn<Context>; }; declare const testProp: PropertyTestFn<unknown>; //#endregion export { PropertyTestFn, fc, test, testProp };