UNPKG

1.11 kBTypeScriptView Raw
1import type { Arbitrary } from '../check/arbitrary/definition/Arbitrary.js';
2/**
3 * Create another Arbitrary with a limited (or capped) number of shrink values
4 *
5 * @example
6 * ```typescript
7 * const dataGenerator: Arbitrary<string> = ...;
8 * const limitedShrinkableDataGenerator: Arbitrary<string> = fc.limitShrink(dataGenerator, 10);
9 * // up to 10 shrunk values could be extracted from the resulting arbitrary
10 * ```
11 *
12 * NOTE: Although limiting the shrinking capabilities can speed up your CI when failures occur, we do not recommend this approach.
13 * Instead, if you want to reduce the shrinking time for automated jobs or local runs, consider using `endOnFailure` or `interruptAfterTimeLimit`.
14 *
15 * @param arbitrary - Instance of arbitrary responsible to generate and shrink values
16 * @param maxShrinks - Maximal number of shrunk values that can be pulled from the resulting arbitrary
17 *
18 * @returns Create another arbitrary with limited number of shrink values
19 * @remarks Since 3.20.0
20 * @public
21 */
22export declare function limitShrink<T>(arbitrary: Arbitrary<T>, maxShrinks: number): Arbitrary<T>;