UNPKG

1.42 kBTypeScriptView Raw
1import type { IRawProperty } from './IRawProperty.js';
2import type { GlobalAsyncPropertyHookFunction } 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 IAsyncPropertyWithHooks}
6 *
7 * @remarks Since 2.2.0
8 * @public
9 */
10export type AsyncPropertyHookFunction = ((previousHookFunction: GlobalAsyncPropertyHookFunction) => Promise<unknown>) | ((previousHookFunction: GlobalAsyncPropertyHookFunction) => void);
11/**
12 * Interface for asynchronous property, see {@link IRawProperty}
13 * @remarks Since 1.19.0
14 * @public
15 */
16export interface IAsyncProperty<Ts> extends IRawProperty<Ts, true> {
17}
18/**
19 * Interface for asynchronous property defining hooks, see {@link IAsyncProperty}
20 * @remarks Since 2.2.0
21 * @public
22 */
23export interface IAsyncPropertyWithHooks<Ts> extends IAsyncProperty<Ts> {
24 /**
25 * Define a function that should be called before all calls to the predicate
26 * @param hookFunction - Function to be called
27 * @remarks Since 1.6.0
28 */
29 beforeEach(hookFunction: AsyncPropertyHookFunction): IAsyncPropertyWithHooks<Ts>;
30 /**
31 * Define a function that should be called after all calls to the predicate
32 * @param hookFunction - Function to be called
33 * @remarks Since 1.6.0
34 */
35 afterEach(hookFunction: AsyncPropertyHookFunction): IAsyncPropertyWithHooks<Ts>;
36}
37
\No newline at end of file