1 | import { Parameters } from './Parameters';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export declare type GlobalPropertyHookFunction = () => void;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export declare type GlobalAsyncPropertyHookFunction = (() => Promise<unknown>) | (() => void);
|
14 | /**
|
15 | * Type describing the global overrides
|
16 | * @remarks Since 1.18.0
|
17 | * @public
|
18 | */
|
19 | export declare type GlobalParameters = Pick<Parameters<unknown>, Exclude<keyof Parameters<unknown>, 'path' | 'examples'>> & {
|
20 | /**
|
21 | * Specify a function that will be called before each execution of a property.
|
22 | * It behaves as-if you manually called `beforeEach` method on all the properties you execute with fast-check.
|
23 | *
|
24 | * The function will be used for both {@link fast-check#property} and {@link fast-check#asyncProperty}.
|
25 | * This global override should never be used in conjunction with `asyncBeforeEach`.
|
26 | *
|
27 | * @remarks Since 2.3.0
|
28 | */
|
29 | beforeEach?: GlobalPropertyHookFunction;
|
30 | /**
|
31 | * Specify a function that will be called after each execution of a property.
|
32 | * It behaves as-if you manually called `afterEach` method on all the properties you execute with fast-check.
|
33 | *
|
34 | * The function will be used for both {@link fast-check#property} and {@link fast-check#asyncProperty}.
|
35 | * This global override should never be used in conjunction with `asyncAfterEach`.
|
36 | *
|
37 | * @remarks Since 2.3.0
|
38 | */
|
39 | afterEach?: GlobalPropertyHookFunction;
|
40 | /**
|
41 | * Specify a function that will be called before each execution of an asynchronous property.
|
42 | * It behaves as-if you manually called `beforeEach` method on all the asynchronous properties you execute with fast-check.
|
43 | *
|
44 | * The function will be used only for {@link fast-check#asyncProperty}. It makes synchronous properties created by {@link fast-check#property} unable to run.
|
45 | * This global override should never be used in conjunction with `beforeEach`.
|
46 | *
|
47 | * @remarks Since 2.3.0
|
48 | */
|
49 | asyncBeforeEach?: GlobalAsyncPropertyHookFunction;
|
50 | /**
|
51 | * Specify a function that will be called after each execution of an asynchronous property.
|
52 | * It behaves as-if you manually called `afterEach` method on all the asynchronous properties you execute with fast-check.
|
53 | *
|
54 | * The function will be used only for {@link fast-check#asyncProperty}. It makes synchronous properties created by {@link fast-check#property} unable to run.
|
55 | * This global override should never be used in conjunction with `afterEach`.
|
56 | *
|
57 | * @remarks Since 2.3.0
|
58 | */
|
59 | asyncAfterEach?: GlobalAsyncPropertyHookFunction;
|
60 | };
|
61 | /**
|
62 | * Define global parameters that will be used by all the runners
|
63 | *
|
64 | * @example
|
65 | * ```typescript
|
66 | * fc.configureGlobal({ numRuns: 10 });
|
67 | * //...
|
68 | * fc.assert(
|
69 | * fc.property(
|
70 | * fc.nat(), fc.nat(),
|
71 | * (a, b) => a + b === b + a
|
72 | * ), { seed: 42 }
|
73 | * ) // equivalent to { numRuns: 10, seed: 42 }
|
74 | * ```
|
75 | *
|
76 | * @param parameters - Global parameters
|
77 | *
|
78 | * @remarks Since 1.18.0
|
79 | * @public
|
80 | */
|
81 | export declare function configureGlobal(parameters: GlobalParameters): void;
|
82 | /**
|
83 | * Read global parameters that will be used by runners
|
84 | * @remarks Since 1.18.0
|
85 | * @public
|
86 | */
|
87 | export declare function readConfigureGlobal(): GlobalParameters | undefined;
|
88 | /**
|
89 | * Reset global parameters
|
90 | * @remarks Since 1.18.0
|
91 | * @public
|
92 | */
|
93 | export declare function resetConfigureGlobal(): void;
|
94 |
|
\ | No newline at end of file |