@@ -3,56 +3,75 @@ export interface Observable {
3
3
}
4
4
5
5
export type Test = ( t : TestContext ) => Promise < void > | Iterator < any > | Observable | void ;
6
+ export type ContextualTest = ( t : ContextualTestContext ) => Promise < void > | Iterator < any > | Observable | void ;
6
7
export type SerialTest = ( t : TestContext ) => void ;
8
+ export type ContextualSerialTest = ( t : ContextualTestContext ) => void ;
7
9
export type CallbackTest = ( t : CallbackTestContext ) => void ;
10
+ export type ContextualCallbackTest = ( t : ContextualCallbackTestContext ) => void ;
8
11
9
12
export interface Runner {
10
13
( name : string , run : Test ) : void ;
11
14
( run : Test ) : void ;
12
15
skip : Runner ;
13
16
cb : CallbackRunner ;
14
17
}
18
+ export interface ContextualRunner {
19
+ ( name : string , run : ContextualTest ) : void ;
20
+ ( run : ContextualTest ) : void ;
21
+ skip : ContextualRunner ;
22
+ cb : ContextualCallbackRunner ;
23
+ }
15
24
export interface SerialRunner {
16
25
( name : string , run : SerialTest ) : void ;
17
26
( run : SerialTest ) : void ;
18
27
skip : SerialRunner ;
19
28
}
29
+ export interface ContextualSerialRunner {
30
+ ( name : string , run : ContextualSerialTest ) : void ;
31
+ ( run : ContextualSerialTest ) : void ;
32
+ skip : ContextualSerialRunner ;
33
+ }
20
34
export interface CallbackRunner {
21
35
( name : string , run : CallbackTest ) : void ;
22
36
( run : CallbackTest ) : void ;
23
37
skip : CallbackRunner ;
24
38
}
39
+ export interface ContextualCallbackRunner {
40
+ ( name : string , run : ContextualCallbackTest ) : void ;
41
+ ( run : ContextualCallbackTest ) : void ;
42
+ skip : ContextualCallbackRunner ;
43
+ }
25
44
26
- export function test ( name : string , run : Test ) : void ;
27
- export function test ( run : Test ) : void ;
45
+ export function test ( name : string , run : ContextualTest ) : void ;
46
+ export function test ( run : ContextualTest ) : void ;
28
47
export namespace test {
29
48
export const before : Runner ;
30
49
export const after : Runner ;
31
- export const beforeEach : Runner ;
32
- export const afterEach : Runner ;
50
+ export const beforeEach : ContextualRunner ;
51
+ export const afterEach : ContextualRunner ;
33
52
34
53
export const skip : typeof test ;
35
54
export const only : typeof test ;
36
55
37
- export function serial ( name : string , run : SerialTest ) : void ;
38
- export function serial ( run : SerialTest ) : void ;
39
- export function cb ( name : string , run : CallbackTest ) : void ;
40
- export function cb ( run : CallbackTest ) : void ;
56
+ export function serial ( name : string , run : ContextualSerialTest ) : void ;
57
+ export function serial ( run : ContextualSerialTest ) : void ;
58
+ export function cb ( name : string , run : ContextualCallbackTest ) : void ;
59
+ export function cb ( run : ContextualCallbackTest ) : void ;
41
60
}
42
61
export namespace test . serial {
43
62
export const before : SerialRunner ;
44
63
export const after : SerialRunner ;
45
- export const beforeEach : SerialRunner ;
46
- export const afterEach : SerialRunner ;
64
+ export const beforeEach : ContextualSerialRunner ;
65
+ export const afterEach : ContextualSerialRunner ;
47
66
48
67
export const skip : typeof test . serial ;
49
68
export const only : typeof test . serial ;
50
69
}
51
70
export namespace test . cb {
52
71
export const before : CallbackRunner ;
53
72
export const after : CallbackRunner ;
54
- export const beforeEach : CallbackRunner ;
55
- export const afterEach : CallbackRunner ;
73
+ export const beforeEach : ContextualCallbackRunner ;
74
+ export const afterEach : ContextualCallbackRunner ;
56
75
57
76
export const skip : typeof test . cb ;
58
77
export const only : typeof test . cb ;
@@ -132,12 +151,16 @@ export interface TestContext extends AssertContext {
132
151
plan ( count : number ) : void ;
133
152
134
153
skip : AssertContext ;
135
-
136
- context : any ;
137
154
}
138
155
export interface CallbackTestContext extends TestContext {
139
156
/**
140
157
* End the test.
141
158
*/
142
159
end ( ) : void ;
143
160
}
161
+ export interface ContextualTestContext extends TestContext {
162
+ context : any ;
163
+ }
164
+ export interface ContextualCallbackTestContext extends CallbackTestContext {
165
+ context : any ;
166
+ }
0 commit comments