Use whenever the task mentions property-based, generative or invariant tests in JavaScript or TypeScript (fast-check): fc.assert and fc.property, arbitraries and composite inputs, map, chain and filter, shrinking and seeds, with Jest, Vitest or Mocha. Has a worked example to start from.
95%
Does it follow best practices?
Impact
94%
0.96xAverage score across 3 eval scenarios
Passed
No findings from the security scan
When a property fails, fast-check prints the falsifying input + a shrunk minimal version + a seed:
Property failed after 47 tests
{ seed: 1234567890, path: "12:1:0", endOnFailure: true }
Counterexample: [{"id": "abc", "age": -1}]
Shrunk 8 time(s)
Got error: Expected age to be >= 18, got -1To reproduce, replay with the seed:
fc.assert(
fc.property(...),
{ seed: 1234567890, path: "12:1:0", endOnFailure: true }
);The seed/path is the deterministic recipe to re-derive the failure.
For CI, set a fixed seed:
import fc from 'fast-check';
fc.configureGlobal({ seed: process.env.CI ? 42 : Date.now() });