CodeVetter · Repo Unpack · Data flow
dubzzz/fast-check
Input data enters through arbitrary factories, predicates, and execution parameters. Generated values carry shrink context, while runner-owned state records execution outcomes and replay coordinates. Plugins transform generation and predicate execution before results reach reporting. Worker execution introduces message serialization or RNG-state reconstruction as an additional boundary.
- asyncProperty splits its arguments into arbitraries and predicate, wraps each arbitrary in AlwaysShrinkableArbitrary, and converts the resulting tuple into positional predicate arguments.
- check overlays local parameters on readConfigureGlobal; qualification defaults to 100 runs, 100 skips per run, empty examples/path, and xorshift128plus, normalizing supplied seeds to a 32-bit representation.
- Each check creates a symbol-keyed plugin Map; global plugin builders precede local builders, and reverse-order decoration makes earlier plugins wrap later generation/run behavior.
- toss yields supplied examples before random cases, jumping the RNG before each generated case; PropertyImplem converts run IDs to bias frequency and protects undefined shrink context with a placeholder.
- Value stores value_ and context and optionally exposes clone-aware value access; RunnerIterator passes value_ to the predicate and retains the associated Value for subsequent shrinking.
- Predicate true/undefined becomes success, thrown PreconditionFailure becomes skip/interruption, and other errors become PropertyFailure; failed outcomes replace the active iterator with shrinks, while skips replenish the initial-run budget.
- RunExecution converts accumulated state into RunDetails containing seed, counterexamplePath, errorInstance, and configuration; assert then calls a custom reporter or formats the counterexample, shrink count, and reproduction parameters.
- Worker mode sends either generated inputs or rngState/runId payloads with predicate and run identifiers; workers reconstruct inputs when needed and return success, failure, or skipped messages, which BasicPool correlates to the current registration.