Skip to main content

Function: interruptAfterTimeLimit()

interruptAfterTimeLimit(timeLimitMs, options?): UniversalPlugin

Defined in: packages/fast-check/src/check/plugin/InterruptAfterTimeLimitPlugin.ts:123

Interrupt test execution after a given time limit.

NOTE: Useful to avoid having too long running processes in your CI while preserving replay capabilities if needed.

WARNING: A test interrupted before any failure counts as a success, even if it did not reach numRuns runs, unless failOnInterrupt is set to true.

As predicates cannot be stopped, the underlying execution keeps running but its outcome gets ignored.

Parameters​

ParameterTypeDescription
timeLimitMsnumberDelay in milliseconds after which runs gets interrupted
options?InterruptAfterTimeLimitOptions-

Returns​

UniversalPlugin

Example​

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

Remarks​

Since 4.10.0