@fast-check/ava
Version:
Property based testing for AVA based on fast-check
21 lines (20 loc) • 862 B
TypeScript
import type { AfterFn, BeforeFn, ImplementationFn } from 'ava';
import test from 'ava';
import * as fc from 'fast-check';
export { fc, test };
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';
export type PropertyTestFn<Context> = PropertyTest<Context> & {
[Modifier in AvaModifierWhitelist]: PropertyTest<Context>;
} & {
before: BeforeFn<Context>;
after: AfterFn<Context>;
};
export declare const testProp: PropertyTestFn<unknown>;