UNPKG

@fast-check/jest

Version:

Property based testing for Jest based on fast-check

25 lines (24 loc) 1.01 kB
import type { it as itJest } from '@jest/globals'; import type { Arbitrary, asyncProperty, assert, readConfigureGlobal } from 'fast-check'; export type FcExtra = { asyncProperty: typeof asyncProperty; assert: typeof assert; readConfigureGlobal: typeof readConfigureGlobal; }; export type JestExtra = { /** * This option is only available since v29.2.0 of Jest * See official release note: https://github.com/facebook/jest/releases/tag/v29.2.0 */ getSeed?: () => number; }; export type It = typeof itJest; export type ArbitraryTuple<Ts extends [any] | any[]> = { [P in keyof Ts]: Arbitrary<Ts[P]>; }; export type ArbitraryRecord<Ts> = { [P in keyof Ts]: Arbitrary<Ts[P]>; }; export type Prop<Ts extends [any] | any[]> = (...args: Ts) => boolean | void | PromiseLike<boolean | void>; export type PropRecord<Ts> = (arg: Ts) => boolean | void | PromiseLike<boolean | void>; export type PromiseProp<Ts extends [any] | any[]> = (...args: Ts) => Promise<boolean | void>;