Skip to main content

Type Alias: PluginInstance<Ts>

PluginInstance<Ts> = object

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

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

Properties

afterAll?

optional afterAll?: () => Promise<void> | void

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

Called once at the end of the full property assessment, after all other methods of the plugin. Use it to clean up and release resources acquired by the plugin.

Every afterAll is guaranteed to run, even if an onAllRunsComplete or another afterAll threw. In case several onAllRunsComplete or afterAll throw, only the first failure is reported, the others will be swallowed.

WARNING: Always return synchronously for synchronous properties.

Returns

Promise<void> | void

Remarks

Since 4.10.0


decorateRun?

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

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

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: If run returns synchronously, the decorated function must too.

Parameters

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

Returns

IRawProperty<Ts, boolean>["run"]

Remarks

Since 4.10.0


onAllRunsComplete?

optional onAllRunsComplete?: (runDetails) => Promise<void> | void

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

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

Throwing allows you to override the default error reporting provided by assert.

Every onAllRunsComplete is guaranteed to run, even if another onAllRunsComplete threw. In case several of them throw, only the first failure is reported, the others will be swallowed.

WARNING: Always return synchronously for synchronous properties.

Parameters

ParameterType
runDetailsRunDetails<Ts>

Returns

Promise<void> | void

Remarks

Since 4.10.0