1 | import type { IRawProperty } from './IRawProperty.js';
|
2 | import type { GlobalPropertyHookFunction } from '../runner/configuration/GlobalParameters.js';
|
3 | /**
|
4 | * Type of legal hook function that can be used to call `beforeEach` or `afterEach`
|
5 | * on a {@link IPropertyWithHooks}
|
6 | *
|
7 | * @remarks Since 2.2.0
|
8 | * @public
|
9 | */
|
10 | export type PropertyHookFunction = (globalHookFunction: GlobalPropertyHookFunction) => void;
|
11 | /**
|
12 | * Interface for synchronous property, see {@link IRawProperty}
|
13 | * @remarks Since 1.19.0
|
14 | * @public
|
15 | */
|
16 | export interface IProperty<Ts> extends IRawProperty<Ts, false> {
|
17 | }
|
18 | /**
|
19 | * Interface for synchronous property defining hooks, see {@link IProperty}
|
20 | * @remarks Since 2.2.0
|
21 | * @public
|
22 | */
|
23 | export interface IPropertyWithHooks<Ts> extends IProperty<Ts> {
|
24 | /**
|
25 | * Define a function that should be called before all calls to the predicate
|
26 | * @param invalidHookFunction - Function to be called, please provide a valid hook function
|
27 | * @remarks Since 1.6.0
|
28 | */
|
29 | beforeEach(invalidHookFunction: (hookFunction: GlobalPropertyHookFunction) => Promise<unknown>): 'beforeEach expects a synchronous function but was given a function returning a Promise';
|
30 | /**
|
31 | * Define a function that should be called before all calls to the predicate
|
32 | * @param hookFunction - Function to be called
|
33 | * @remarks Since 1.6.0
|
34 | */
|
35 | beforeEach(hookFunction: PropertyHookFunction): IPropertyWithHooks<Ts>;
|
36 | /**
|
37 | * Define a function that should be called after all calls to the predicate
|
38 | * @param invalidHookFunction - Function to be called, please provide a valid hook function
|
39 | * @remarks Since 1.6.0
|
40 | */
|
41 | afterEach(invalidHookFunction: (hookFunction: GlobalPropertyHookFunction) => Promise<unknown>): 'afterEach expects a synchronous function but was given a function returning a Promise';
|
42 | /**
|
43 | * Define a function that should be called after all calls to the predicate
|
44 | * @param hookFunction - Function to be called
|
45 | * @remarks Since 1.6.0
|
46 | */
|
47 | afterEach(hookFunction: PropertyHookFunction): IPropertyWithHooks<Ts>;
|
48 | }
|