forked from testdeck/testdeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
95 lines (81 loc) · 4.13 KB
/
index.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
declare namespace Mocha {
export interface IContextDefinition {}
export interface ITestDefinition {}
export interface ISuiteCallbackContext {}
export interface ITestCallbackContext {}
export interface ITest {
<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
}
export interface ISuite {
<TFunction extends Function>(target: TFunction): TFunction | void;
}
}
interface MochaDone {
(error?: any): any;
}
declare namespace MochaTypeScript {
export interface Suite {
prototype: {
before?: (done?: MochaDone) => void;
after?: (done?: MochaDone) => void;
};
before?: (done?: MochaDone) => void;
after?: (done?: MochaDone) => void;
new(): any;
}
export interface SuiteTrait {
(this: Mocha.ISuiteCallbackContext, ctx: Mocha.ISuiteCallbackContext, ctor: Function): void;
}
export interface TestTrait {
(this: Mocha.ITestCallbackContext, ctx: Mocha.ITestCallbackContext, instance: Object, method: Function): void;
}
export interface IContextDefinition {
/**
* This is either a single trait overload `(trait: MochaTypeScript.SuiteTrait): ClassDecorator`
* or a class decorator overload `(target: Function): void`.
* Can't figure out proper typing.
*/
(args: any): any;
(): ClassDecorator;
(name: string): ClassDecorator;
(name: string, ... traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
(trait: MochaTypeScript.SuiteTrait, ... traits:MochaTypeScript.SuiteTrait[]): ClassDecorator;
only(arg: any): any;
only(): ClassDecorator;
only(name: string): ClassDecorator;
only(name: string, ... traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
only(... traits:MochaTypeScript.SuiteTrait[]): ClassDecorator;
skip(arg: any): any;
skip(): ClassDecorator;
skip(name: string): ClassDecorator;
skip(name: string, ... traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
skip(... traits:MochaTypeScript.SuiteTrait[]): ClassDecorator;
}
export interface ITestDefinition {
(target: Object, propertyKey: string | symbol): void;
(name: string): PropertyDecorator;
(name: string, ... traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
(... traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
only(target: Object, propertyKey: string | symbol): void;
only(name: string): PropertyDecorator;
only(name: string, ... traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
only(... traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
skip(target: Object, propertyKey: string | symbol): void;
skip(name: string): PropertyDecorator;
skip(name: string, ... traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
skip(... traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
}
}
declare module "mocha-typescript" {
export const suite: Mocha.IContextDefinition & MochaTypeScript.IContextDefinition;
export const test: Mocha.ITestDefinition & MochaTypeScript.ITestDefinition;
export const describe: Mocha.IContextDefinition & MochaTypeScript.IContextDefinition;
export const it: Mocha.ITestDefinition & MochaTypeScript.ITestDefinition;
export function slow(time: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
export function timeout(time: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
export function pending<TFunction extends Function>(target: Object | TFunction, propertyKey?: string | symbol): void;
export function only<TFunction extends Function>(target: Object, propertyKey?: string | symbol): void;
export function skip<TFunction extends Function>(target: Object | TFunction, propertyKey?: string | symbol): void;
export function context(target: Object, propertyKey: string | symbol): void;
export const skipOnError: MochaTypeScript.SuiteTrait;
}