|
| 1 | +declare function test(title: string, implementation: TestImplementation): void; |
| 2 | +declare function test(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 3 | +declare function test(macro: Macro | Macro[], ...args: any[]): void; |
| 4 | +export default test; |
| 5 | + |
| 6 | +declare namespace test { |
| 7 | + function after(title: string, implementation: HookImplementation): void; |
| 8 | + function after(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 9 | + function after(macro: Macro | Macro[], ...args: any[]): void; |
| 10 | + |
| 11 | + function afterEach(title: string, implementation: HookImplementation): void; |
| 12 | + function afterEach(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 13 | + function afterEach(macro: Macro | Macro[], ...args: any[]): void; |
| 14 | + |
| 15 | + function before(title: string, implementation: HookImplementation): void; |
| 16 | + function before(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 17 | + function before(macro: Macro | Macro[], ...args: any[]): void; |
| 18 | + |
| 19 | + function beforeEach(title: string, implementation: HookImplementation): void; |
| 20 | + function beforeEach(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 21 | + function beforeEach(macro: Macro | Macro[], ...args: any[]): void; |
| 22 | + |
| 23 | + function cb(title: string, implementation: TestImplementation): void; |
| 24 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 25 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 26 | + |
| 27 | + function failing(title: string, implementation: TestImplementation): void; |
| 28 | + function failing(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 29 | + function failing(macro: Macro | Macro[], ...args: any[]): void; |
| 30 | + |
| 31 | + function only(title: string, implementation: TestImplementation): void; |
| 32 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 33 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 34 | + |
| 35 | + function serial(title: string, implementation: TestImplementation): void; |
| 36 | + function serial(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 37 | + function serial(macro: Macro | Macro[], ...args: any[]): void; |
| 38 | + |
| 39 | + function skip(title: string, implementation: TestImplementation): void; |
| 40 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 41 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 42 | + |
| 43 | + function todo(title: string): void; |
| 44 | + |
| 45 | + namespace after { |
| 46 | + function always(title: string, implementation: HookImplementation): void; |
| 47 | + function always(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 48 | + function always(macro: Macro | Macro[], ...args: any[]): void; |
| 49 | + |
| 50 | + function cb(title: string, implementation: HookImplementation<CbExecutionContext>): void; |
| 51 | + function cb(title: string, macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 52 | + function cb(macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 53 | + |
| 54 | + function skip(title: string, implementation: HookImplementation): void; |
| 55 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 56 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 57 | + |
| 58 | + namespace always { |
| 59 | + function cb(title: string, implementation: HookImplementation): void; |
| 60 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 61 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 62 | + |
| 63 | + function skip(title: string, implementation: HookImplementation): void; |
| 64 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 65 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 66 | + |
| 67 | + namespace cb { |
| 68 | + function skip(title: string, implementation: HookImplementation): void; |
| 69 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 70 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + namespace afterEach { |
| 76 | + function always(title: string, implementation: HookImplementation): void; |
| 77 | + function always(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 78 | + function always(macro: Macro | Macro[], ...args: any[]): void; |
| 79 | + |
| 80 | + function cb(title: string, implementation: HookImplementation<CbExecutionContext>): void; |
| 81 | + function cb(title: string, macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 82 | + function cb(macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 83 | + |
| 84 | + function skip(title: string, implementation: HookImplementation): void; |
| 85 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 86 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 87 | + |
| 88 | + namespace always { |
| 89 | + function cb(title: string, implementation: HookImplementation): void; |
| 90 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 91 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 92 | + |
| 93 | + function skip(title: string, implementation: HookImplementation): void; |
| 94 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 95 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 96 | + |
| 97 | + namespace cb { |
| 98 | + function skip(title: string, implementation: HookImplementation): void; |
| 99 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 100 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + |
| 105 | + namespace before { |
| 106 | + function cb(title: string, implementation: HookImplementation<CbExecutionContext>): void; |
| 107 | + function cb(title: string, macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 108 | + function cb(macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 109 | + |
| 110 | + function skip(title: string, implementation: HookImplementation): void; |
| 111 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 112 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 113 | + } |
| 114 | + |
| 115 | + namespace beforeEach { |
| 116 | + function cb(title: string, implementation: HookImplementation<CbExecutionContext>): void; |
| 117 | + function cb(title: string, macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 118 | + function cb(macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 119 | + |
| 120 | + function skip(title: string, implementation: HookImplementation): void; |
| 121 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 122 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 123 | + } |
| 124 | + |
| 125 | + namespace cb { |
| 126 | + function failing(title: string, implementation: TestImplementation): void; |
| 127 | + function failing(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 128 | + function failing(macro: Macro | Macro[], ...args: any[]): void; |
| 129 | + |
| 130 | + function only(title: string, implementation: TestImplementation): void; |
| 131 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 132 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 133 | + |
| 134 | + function skip(title: string, implementation: TestImplementation): void; |
| 135 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 136 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 137 | + |
| 138 | + namespace failing { |
| 139 | + function only(title: string, implementation: TestImplementation): void; |
| 140 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 141 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 142 | + |
| 143 | + function skip(title: string, implementation: TestImplementation): void; |
| 144 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 145 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | + namespace failing { |
| 150 | + function only(title: string, implementation: TestImplementation): void; |
| 151 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 152 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 153 | + |
| 154 | + function skip(title: string, implementation: TestImplementation): void; |
| 155 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 156 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 157 | + } |
| 158 | + |
| 159 | + namespace serial { |
| 160 | + function after(title: string, implementation: HookImplementation): void; |
| 161 | + function after(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 162 | + function after(macro: Macro | Macro[], ...args: any[]): void; |
| 163 | + |
| 164 | + function afterEach(title: string, implementation: HookImplementation): void; |
| 165 | + function afterEach(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 166 | + function afterEach(macro: Macro | Macro[], ...args: any[]): void; |
| 167 | + |
| 168 | + function before(title: string, implementation: HookImplementation): void; |
| 169 | + function before(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 170 | + function before(macro: Macro | Macro[], ...args: any[]): void; |
| 171 | + |
| 172 | + function beforeEach(title: string, implementation: HookImplementation): void; |
| 173 | + function beforeEach(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 174 | + function beforeEach(macro: Macro | Macro[], ...args: any[]): void; |
| 175 | + |
| 176 | + function cb(title: string, implementation: TestImplementation<CbExecutionContext>): void; |
| 177 | + function cb(title: string, macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 178 | + function cb(macro: Macro<CbExecutionContext> | Macro<CbExecutionContext>[], ...args: any[]): void; |
| 179 | + |
| 180 | + function failing(title: string, implementation: TestImplementation): void; |
| 181 | + function failing(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 182 | + function failing(macro: Macro | Macro[], ...args: any[]): void; |
| 183 | + |
| 184 | + function only(title: string, implementation: TestImplementation): void; |
| 185 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 186 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 187 | + |
| 188 | + function skip(title: string, implementation: TestImplementation): void; |
| 189 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 190 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 191 | + |
| 192 | + function todo(title: string): void; |
| 193 | + |
| 194 | + namespace after { |
| 195 | + function always(title: string, implementation: HookImplementation): void; |
| 196 | + function always(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 197 | + function always(macro: Macro | Macro[], ...args: any[]): void; |
| 198 | + |
| 199 | + function cb(title: string, implementation: HookImplementation): void; |
| 200 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 201 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 202 | + |
| 203 | + function skip(title: string, implementation: HookImplementation): void; |
| 204 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 205 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 206 | + |
| 207 | + namespace always { |
| 208 | + function cb(title: string, implementation: HookImplementation): void; |
| 209 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 210 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 211 | + |
| 212 | + function skip(title: string, implementation: HookImplementation): void; |
| 213 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 214 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 215 | + |
| 216 | + namespace cb { |
| 217 | + function skip(title: string, implementation: HookImplementation): void; |
| 218 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 219 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 220 | + } |
| 221 | + } |
| 222 | + } |
| 223 | + |
| 224 | + namespace afterEach { |
| 225 | + function always(title: string, implementation: HookImplementation): void; |
| 226 | + function always(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 227 | + function always(macro: Macro | Macro[], ...args: any[]): void; |
| 228 | + |
| 229 | + function cb(title: string, implementation: HookImplementation): void; |
| 230 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 231 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 232 | + |
| 233 | + function skip(title: string, implementation: HookImplementation): void; |
| 234 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 235 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 236 | + |
| 237 | + namespace always { |
| 238 | + function cb(title: string, implementation: HookImplementation): void; |
| 239 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 240 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 241 | + |
| 242 | + function skip(title: string, implementation: HookImplementation): void; |
| 243 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 244 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 245 | + |
| 246 | + namespace cb { |
| 247 | + function skip(title: string, implementation: HookImplementation): void; |
| 248 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 249 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 250 | + } |
| 251 | + } |
| 252 | + } |
| 253 | + |
| 254 | + namespace before { |
| 255 | + function cb(title: string, implementation: HookImplementation): void; |
| 256 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 257 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 258 | + |
| 259 | + function skip(title: string, implementation: HookImplementation): void; |
| 260 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 261 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 262 | + } |
| 263 | + |
| 264 | + namespace beforeEach { |
| 265 | + function cb(title: string, implementation: HookImplementation): void; |
| 266 | + function cb(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 267 | + function cb(macro: Macro | Macro[], ...args: any[]): void; |
| 268 | + |
| 269 | + function skip(title: string, implementation: HookImplementation): void; |
| 270 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 271 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 272 | + } |
| 273 | + |
| 274 | + namespace cb { |
| 275 | + function failing(title: string, implementation: TestImplementation): void; |
| 276 | + function failing(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 277 | + function failing(macro: Macro | Macro[], ...args: any[]): void; |
| 278 | + |
| 279 | + function only(title: string, implementation: TestImplementation): void; |
| 280 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 281 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 282 | + |
| 283 | + function skip(title: string, implementation: TestImplementation): void; |
| 284 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 285 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 286 | + |
| 287 | + namespace failing { |
| 288 | + function only(title: string, implementation: TestImplementation): void; |
| 289 | + function only(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 290 | + function only(macro: Macro | Macro[], ...args: any[]): void; |
| 291 | + |
| 292 | + function skip(title: string, implementation: TestImplementation): void; |
| 293 | + function skip(title: string, macro: Macro | Macro[], ...args: any[]): void; |
| 294 | + function skip(macro: Macro | Macro[], ...args: any[]): void; |
| 295 | + } |
| 296 | + } |
| 297 | + } |
| 298 | +} |
| 299 | + |
| 300 | +export interface Observable { |
| 301 | + subscribe(observer: (value: any) => void): void; |
| 302 | +} |
| 303 | + |
| 304 | +export type ThrowsErrorValidator = (new (...args: any[]) => any) | RegExp | string | ((error: any) => boolean); |
| 305 | + |
| 306 | +export interface SnapshotOptions { |
| 307 | + id?: string; |
| 308 | +} |
| 309 | + |
| 310 | +export interface Assertions { |
| 311 | + deepEqual<U>(actual: U, expected: U, message?: string): void; |
| 312 | + fail(message?: string): void; |
| 313 | + false(actual: any, message?: string): void; |
| 314 | + falsy(actual: any, message?: string): void; |
| 315 | + ifError(error: any, message?: string): void; |
| 316 | + is<U>(actual: U, expected: U, message?: string): void; |
| 317 | + not<U>(actual: U, message?: string): void; |
| 318 | + notDeepEqual<U>(actual: U, expected: U, message?: string): void; |
| 319 | + notRegex(string: string, regex: RegExp, message?: string): void; |
| 320 | + notThrows(value: () => Observable, message?: string): Promise<void>; |
| 321 | + notThrows(value: () => PromiseLike<any>, message?: string): Promise<void>; |
| 322 | + notThrows(value: () => void, message?: string): void; |
| 323 | + notThrows(value: Observable, message?: string): Promise<void>; |
| 324 | + notThrows(value: PromiseLike<any>, message?: string): Promise<void>; |
| 325 | + pass(message?: string): void; |
| 326 | + regex(string: string, regex: RegExp, message?: string): void; |
| 327 | + snapshot(expected: any, message?: string): void; |
| 328 | + snapshot(expected: any, options: SnapshotOptions, message?: string): void; |
| 329 | + throws<U>(value: () => Observable, error?: ThrowsErrorValidator, message?: string): Promise<U | void>; |
| 330 | + throws<U>(value: () => PromiseLike<any>, error?: ThrowsErrorValidator, message?: string): Promise<U | void>; |
| 331 | + throws<U>(value: () => void, error?: ThrowsErrorValidator, message?: string): U | void; |
| 332 | + throws<U>(value: Observable, error?: ThrowsErrorValidator, message?: string): Promise<U | void>; |
| 333 | + throws<U>(value: PromiseLike<any>, error?: ThrowsErrorValidator, message?: string): Promise<U | void>; |
| 334 | + true(actual: any, message?: string): void; |
| 335 | + truthy(actual: any, message?: string): void; |
| 336 | +} |
| 337 | + |
| 338 | +export interface ExecutionContext extends Assertions { |
| 339 | + skip: Assertions; |
| 340 | + title: string; |
| 341 | + log(...values: any[]): void; |
| 342 | + plan(count: number): void; |
| 343 | +} |
| 344 | + |
| 345 | +export interface CbExecutionContext extends ExecutionContext { |
| 346 | + end(): void; |
| 347 | +} |
| 348 | + |
| 349 | +export type ImplementationResult = PromiseLike<void> | Observable | Iterator<any> | void; |
| 350 | +export type HookImplementation<T extends ExecutionContext = ExecutionContext> = (t?: T) => ImplementationResult; |
| 351 | +export type TestImplementation<T extends ExecutionContext = ExecutionContext> = (t: T) => ImplementationResult; |
| 352 | + |
| 353 | +export interface Macro<T extends ExecutionContext = ExecutionContext> { |
| 354 | + (t: T, ...args: any[]): ImplementationResult; |
| 355 | + title?(providedTitle: string, ...args: any[]): string; |
| 356 | +} |
0 commit comments