-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.d.ts
136 lines (107 loc) · 3.5 KB
/
main.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
declare function MochaUiMeta(suite: any): void;
declare module 'mocha-ui-bdd-meta' {
export = MochaUiMeta;
}
declare var beforeAll: MochaUiMeta.MetaHookFunction;
declare var beforeEach: MochaUiMeta.MetaHookFunction;
declare var describe: MochaUiMeta.MetaSuiteFunction;
declare var fdescribe: MochaUiMeta.MetaSuiteFunction;
declare var xdescribe: MochaUiMeta.MetaSuiteFunction;
declare var it: MochaUiMeta.MetaTestFunction;
declare var fit: MochaUiMeta.MetaTestFunction;
declare var xit: MochaUiMeta.MetaTestFunction;
declare var test: MochaUiMeta.MetaTestFunction;
declare var xtest: MochaUiMeta.MetaTestFunction;
declare namespace MochaUiMeta {
type Done = (err?: any) => void;
type Func = (this: MetaContext, done: Done) => void;
type AsyncFunc = (this: MetaContext) => PromiseLike<any>;
interface Error {
name: string;
message: string;
stack?: string;
}
interface MetaHookFunction {
(fn: Func): void;
(fn: AsyncFunc): void;
(name: string, fn?: Func): void;
(name: string, fn?: AsyncFunc): void;
}
interface MetaSuiteFunction {
(title: string, fn?: Func): MetaSuite;
(title: string, fn?: AsyncFunc): MetaSuite;
(title: string, meta?: unknown, fn?: Func): MetaSuite;
(title: string, meta?: unknown, fn?: AsyncFunc): MetaSuite;
only: MetaExclusiveSuiteFunction
skip: MetaPendingSuiteFunction
}
interface MetaTestFunction {
(fn: Func): MetaTest;
(fn: AsyncFunc): MetaTest;
(title: string, fn?: Func): MetaTest;
(title: string, fn?: AsyncFunc): MetaTest;
(name: string, meta?: unknown, fn?: Func): MetaTest;
(name: string, meta?: unknown, fn?: AsyncFunc): MetaTest;
retries(n: number): void;
only: MetaExclusiveTestFunction
skip: MetaPendingTestFunction
}
interface MetaSuite {
(name: number | string | Function | FunctionLike, meta?: unknown, fn?: EmptyFunction): void;
ctx: MetaContext;
suites: MetaSuite[];
tests: MetaTest[];
pending: boolean;
file?: string | undefined;
root: boolean;
delayed: boolean;
parent: MetaSuite | undefined;
title: string
only: MetaSuite;
skip: MetaSuite;
meta?: unknown;
}
interface MetaTest {
(name: string, meta?: unknown, fn?: Func): void;
title: string;
fn: Func | AsyncFunc | undefined;
body: string;
async: boolean;
sync: boolean;
timedOut: boolean;
pending: boolean;
duration?: number | undefined;
parent?: MetaSuite | undefined;
state?: "failed" | "passed" | undefined;
timer?: any;
ctx?: MetaContext | undefined;
callback?: Done | undefined;
allowUncaught?: boolean | undefined;
file?: string | undefined;
type: "test";
speed?: "slow" | "medium" | "fast" | undefined; // added by reporters
err?: Error | undefined; // added by reporters
clone(): MetaTest;
only: MetaTest;
skip: MetaTest;
meta?: unknown;
}
class MetaContext {
test?: MetaTest | undefined;
meta?: unknown;
}
interface MetaExclusiveSuiteFunction {
(title: string, meta?: unknown, fn?: Func): MetaSuite;
(title: string, meta?: unknown, fn?: AsyncFunc): MetaSuite;
(title: string, meta?: unknown): MetaSuite;
}
interface MetaPendingSuiteFunction {
(title: string, meta?: unknown, fn?: Func): MetaSuite | void;
}
interface MetaPendingTestFunction {
(title: string, fn?: (this: MetaContext, done: Done) => void): MetaTest;
}
interface MetaExclusiveTestFunction {
(title: string, fn?: (this: MetaContext, done: Done) => void): MetaTest;
}
}