Skip to main content

Interface: IteratorConstraints

Defined in: packages/fast-check/src/arbitrary/iterator.ts:11

Constraints to be applied on iterator

Remarks​

Since 5.0.0 (previously called InfiniteStreamConstraints in 4.3.0)

Properties​

maxLength?​

optional maxLength?: number

Defined in: packages/fast-check/src/arbitrary/iterator.ts:28

Upper bound for the number of items the generated iterators will yield before completing. Number.POSITIVE_INFINITY is accepted and means never-ending iterators may be generated, while any finite value makes every generated iterator finite.

Default Value​

Number.POSITIVE_INFINITY by default, Number.MAX_SAFE_INTEGER when noDefaultInfinity is true

Remarks​

Since 5.0.0


minLength?​

optional minLength?: number

Defined in: packages/fast-check/src/arbitrary/iterator.ts:19

Lower bound for the number of items the generated iterators will yield before completing. Number.POSITIVE_INFINITY is accepted: it forces every generated iterator to be a never-ending one.

Default Value​

0

Remarks​

Since 5.0.0


noDefaultInfinity?​

optional noDefaultInfinity?: boolean

Defined in: packages/fast-check/src/arbitrary/iterator.ts:38

By default, maxLength defaults to Number.POSITIVE_INFINITY meaning never-ending iterators get generated from time to time. By setting noDefaultInfinity to true, you move this default to Number.MAX_SAFE_INTEGER so that only finite iterators get generated unless you explicitly pass maxLength: Number.POSITIVE_INFINITY.

Default Value​

false

Remarks​

Since 5.0.0


noHistory?​

optional noHistory?: boolean

Defined in: packages/fast-check/src/arbitrary/iterator.ts:56

Do not save items emitted by this arbitrary and print count instead. Recommended for very large tests.

Default Value​

false

size?​

optional size?: SizeForArbitrary

Defined in: packages/fast-check/src/arbitrary/iterator.ts:49

Define how large the generated values should be (at max).

It caps the number of items the generated finite iterators will yield the same way it caps the length of arrays, maxLength staying the hard upper bound.

It has no impact on never-ending iterators.

Remarks​

Since 5.0.0