UNPKG

751 BTypeScriptView Raw
1declare namespace uvu {
2 type Crumbs = { __suite__: string; __test__: string };
3 type Callback<T> = (context: T & Crumbs) => Promise<void> | void;
4
5 interface Hook<T> {
6 (hook: Callback<T>): void;
7 each(hook: Callback<T>): void;
8 }
9
10 interface Test<T> {
11 (name: string, test: Callback<T>): void;
12 only(name: string, test: Callback<T>): void;
13 skip(name?: string, test?: Callback<T>): void;
14 before: Hook<T>;
15 after: Hook<T>
16 run(): void;
17 }
18}
19
20type Context = Record<string, any>;
21
22export type Test<T=Context> = uvu.Test<T>;
23export type Callback<T=Context> = uvu.Callback<T>;
24
25export const test: uvu.Test<Context>;
26export function suite<T=Context>(title?: string, context?: T): uvu.Test<T>;
27export function exec(bail?: boolean): Promise<void>;