Skip to main content

Type Alias: PluginInstance<Ts, IsAsync>

PluginInstance<Ts, IsAsync> = object

Defined in: packages/fast-check/src/check/plugin/Plugin.ts:15

Runtime part of a plugin.

The runtime part is made of the hooks called by the runner. Hooks will be called when relevant for the runner.

All the hooks are optional.

Remarks

Since 4.10.0

Type Parameters

Type Parameter
Ts
IsAsync extends boolean

Properties

afterAll?

optional afterAll?: (runDetails) => IsAsync extends true ? Promise<void> | void : void

Defined in: packages/fast-check/src/check/plugin/Plugin.ts:42

Called once at the end of the full property assessment. Gets called with the result of the execution.

WARNING: afterAll must not throw. Throwing would shadow the output of the property execution. WARNING: Make sure to always return synchronously except if you set asyncOnly: true.

Parameters

ParameterType
runDetailsRunDetails<Ts>

Returns

IsAsync extends true ? Promise<void> | void : void

Remarks

Since 4.10.0


asyncOnly?

optional asyncOnly?: IsAsync extends false ? false : boolean

Defined in: packages/fast-check/src/check/plugin/Plugin.ts:22

Whether or not the plugin can only be attached to asynchronous properties.

Default Value

false

Remarks

Since 4.10.0


decorateRun?

optional decorateRun?: (nestedRun) => IRawProperty<Ts, IsAsync>["run"]

Defined in: packages/fast-check/src/check/plugin/Plugin.ts:32

Enrich the execution of the predicate linked to the property with extra behaviors. Called once per execution of the predicate.

WARNING: nestedRun never throws and neither should the function returned by decorateRun. WARNING: Except in asyncOnly: true mode, if run returns synchronously, the decorated function must too.

Parameters

ParameterType
nestedRunIRawProperty<Ts, IsAsync>["run"]

Returns

IRawProperty<Ts, IsAsync>["run"]

Remarks

Since 4.10.0