Skip to main content

Iterable

Generate iterable values.

infiniteStream

Generate infinite Stream of values generated by arb.

The Stream structure provided by fast-check implements IterableIterator<T> and comes with useful helpers to manipulate it.

Signatures:

  • fc.infiniteStream(arb)
  • fc.infiniteStream(arb, {noHistory?})

with:

  • arbarbitrary instance responsible to generate values
  • noHistory? — default: false — Omit generated values from the string representation. Recommended for very large tests due to the history's unbounded memory use.

Usages:

fc.infiniteStream(fc.nat(9));
// Examples of generated values: Stream(…)…

fc.infiniteStream(fc.nat(9), { noHistory: true });
// Examples of generated values: Stream(0 emitted)…

Resources: API reference.
Available since 1.8.0.