Skip to main content

Function: interruptAfterTimeLimit()

interruptAfterTimeLimit(timeLimitMs, options?): Plugin<unknown>

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

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
optionsInterruptAfterTimeLimitOptions-

Returns​

Plugin<unknown>

Example​

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

Remarks​

Since 4.10.0