Skip to main content

Function: beforeEachPlugin()

beforeEachPlugin(fn): Plugin<unknown>

Defined in: packages/fast-check/src/check/plugin/LifeCyclePlugins.ts:62

Register a callback to be called before each run of your predicate. If the function returns a promise, we wait until the promise resolves before running anything else.

Parameters

ParameterTypeDescription
fnBeforeEachHookHook to be executed before each execution of the predicate

Returns

Plugin<unknown>

Example

fc.assert(
fc.property(..., (...) => {...}),
{ plugins: [fc.beforeEachPlugin(() => {...})] }
)

Remarks

Since 4.10.0