• Create another Arbitrary with a limited (or capped) number of shrink values

    Type Parameters

    • T

    Parameters

    • arbitrary: Arbitrary<T>

      Instance of arbitrary responsible to generate and shrink values

    • maxShrinks: number

      Maximal number of shrunk values that can be pulled from the resulting arbitrary

    Returns Arbitrary<T>

    Create another arbitrary with limited number of shrink values

    const dataGenerator: Arbitrary<string> = ...;
    const limitedShrinkableDataGenerator: Arbitrary<string> = fc.limitShrink(dataGenerator, 10);
    // up to 10 shrunk values could be extracted from the resulting arbitrary

    NOTE: Although limiting the shrinking capabilities can speed up your CI when failures occur, we do not recommend this approach. Instead, if you want to reduce the shrinking time for automated jobs or local runs, consider using endOnFailure or interruptAfterTimeLimit.

    Since 3.20.0