Skip to main content

Function: timeout()

timeout(timeMs): UniversalPlugin

Defined in: packages/fast-check/src/check/plugin/TimeoutPlugin.ts:100

Mark the execution of a predicate as failed if it exceeds timeMs milliseconds to complete.

WARNING: It cannot stop a running predicate. It mainly returns earlier so the test runner can move forward.

NOTE: Synchronous predicates are checked once they return and fail if they exceeded the limit.

Parameters​

ParameterTypeDescription
timeMsnumberMaximal number of milliseconds granted to an execution of the predicate

Returns​

UniversalPlugin

Example​

fc.assert(
fc.property(..., async (...) => {...}),
{ plugins: [fc.timeout(1000)] }
)

Remarks​

Since 4.10.0