@@ -93,26 +93,23 @@ type ContextualTestContext = TestContext & { context: any; };
93
93
type ContextualCallbackTestContext = CallbackTestContext & { context: any; };
94
94
95
95
/**
96
- * Test Types
96
+ * Test Implementations
97
97
*/
98
98
99
- type Test = (t: TestContext) => SpecialReturnTypes | void;
100
- type CallbackTest = (t: CallbackTestContext) => void;
101
- type ContextualTest = (t: ContextualTestContext) => SpecialReturnTypes | void;
102
- type ContextualCallbackTest = (t: ContextualCallbackTestContext) => void;
103
-
104
- /**
105
- * Macro Types
106
- */
107
-
108
- type Macro<T> = {
109
- (t: T, ...args: Array<any>): void;
99
+ type TestFunction<T, R> = {
100
+ (t: T, ...args: Array<any>): R;
110
101
title?: (providedTitle: string, ...args: Array<any>) => string;
111
102
};
112
103
113
- type Macros<T> =
114
- | Macro<T>
115
- | Array<Macro<T>>;
104
+ type TestImplementation<T, R> =
105
+ | TestFunction<T, R>
106
+ | Array<TestFunction<T, R>>;
107
+
108
+ type Test = TestImplementation<TestContext, SpecialReturnTypes | void>;
109
+ type CallbackTest = TestImplementation<CallbackTestContext, void>;
110
+ type ContextualTest = TestImplementation<ContextualTestContext, SpecialReturnTypes | void>;
111
+ type ContextualCallbackTest = TestImplementation<ContextualCallbackTestContext, void>;
112
+
116
113
117
114
/**
118
115
* Method Types
@@ -121,8 +118,6 @@ type Macros<T> =
121
118
type TestMethod = {
122
119
( implementation: Test): void;
123
120
(name: string, implementation: Test): void;
124
- ( implementation: Macros<TestContext>, ...args: Array<any>): void;
125
- (name: string, implementation: Macros<TestContext>, ...args: Array<any>): void;
126
121
127
122
serial : TestMethod;
128
123
before : TestMethod;
@@ -140,8 +135,6 @@ type TestMethod = {
140
135
type CallbackTestMethod = {
141
136
( implementation: CallbackTest): void;
142
137
(name: string, implementation: CallbackTest): void;
143
- ( implementation: Macros<CallbackTestContext>, ...args: Array<any>): void;
144
- (name: string, implementation: Macros<CallbackTestContext>, ...args: Array<any>): void;
145
138
146
139
serial : CallbackTestMethod;
147
140
before : CallbackTestMethod;
@@ -159,8 +152,6 @@ type CallbackTestMethod = {
159
152
type ContextualTestMethod = {
160
153
( implementation: ContextualTest): void;
161
154
(name: string, implementation: ContextualTest): void;
162
- ( implementation: Macros<ContextualTestContext>, ...args: Array<any>): void;
163
- (name: string, implementation: Macros<ContextualTestContext>, ...args: Array<any>): void;
164
155
165
156
serial : ContextualTestMethod;
166
157
before : ContextualTestMethod;
@@ -178,8 +169,6 @@ type ContextualTestMethod = {
178
169
type ContextualCallbackTestMethod = {
179
170
( implementation: ContextualCallbackTest): void;
180
171
(name: string, implementation: ContextualCallbackTest): void;
181
- ( implementation: Macros<ContextualCallbackTestContext>, ...args: Array<any>): void;
182
- (name: string, implementation: Macros<ContextualCallbackTestContext>, ...args: Array<any>): void;
183
172
184
173
serial : ContextualCallbackTestMethod;
185
174
before : ContextualCallbackTestMethod;
@@ -201,8 +190,6 @@ type ContextualCallbackTestMethod = {
201
190
declare module.exports: {
202
191
( run: ContextualTest): void;
203
192
(name: string, run: ContextualTest): void;
204
- ( run: Macros<ContextualTestContext>, ...args: Array<any>): void;
205
- (name: string, run: Macros<ContextualTestContext>, ...args: Array<any>): void;
206
193
207
194
beforeEach : TestMethod;
208
195
afterEach : TestMethod;
0 commit comments