-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.d.ts
157 lines (133 loc) · 4.71 KB
/
project.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// ================= mocha =======================
// Type definitions for mocha 2.2.5
// Project: http://mochajs.org/
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Fixed for ts2.0
interface MochaSetupOptions {
// milliseconds to wait before considering a test slow
slow?: number;
// timeout in milliseconds
timeout?: number;
// ui name "bdd", "tdd", "exports" etc
ui?: string;
// array of accepted globals
globals?: any[];
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
reporter?: any;
// bail on the first test failure
bail?: boolean;
// ignore global leaks
ignoreLeaks?: boolean;
// grep string or regexp to filter tests with
grep?: any;
}
declare var describe: Mocha.MochaContextDefinition;
declare var xdescribe: Mocha.MochaContextDefinition;
// alias for `describe`
declare var context: Mocha.MochaContextDefinition;
// alias for `describe`
declare var suite: Mocha.MochaContextDefinition;
declare var it: Mocha.MochaTestDefinition;
declare var xit: Mocha.MochaTestDefinition;
// alias for `it`
declare var test: Mocha.MochaTestDefinition;
declare var specify: Mocha.MochaTestDefinition;
interface MochaDone {
(error?: any): any;
}
interface ActionFunction {
(done: MochaDone): any | PromiseLike<any>;
}
declare function setup(action: ActionFunction): void;
declare function teardown(action: ActionFunction): void;
declare function suiteSetup(action: ActionFunction): void;
declare function suiteTeardown(action: ActionFunction): void;
declare function before(action: ActionFunction): void;
declare function before(description: string, action: ActionFunction): void;
declare function after(action: ActionFunction): void;
declare function after(description: string, action: ActionFunction): void;
declare function beforeEach(action: ActionFunction): void;
declare function beforeEach(description: string, action: ActionFunction): void;
declare function afterEach(action: ActionFunction): void;
declare function afterEach(description: string, action: ActionFunction): void;
// merge the Mocha class declaration with a module
declare namespace Mocha {
/** Partial interface for Mocha's `Runnable` class. */
interface MochaRunnable {
title: string;
fn: Function;
async: boolean;
sync: boolean;
timedOut: boolean;
}
/** Partial interface for Mocha's `Suite` class. */
interface MochaSuite {
parent: MochaSuite;
title: string;
fullTitle(): string;
}
/** Partial interface for Mocha's `Test` class. */
interface MochaTest extends MochaRunnable {
parent: MochaSuite;
pending: boolean;
fullTitle(): string;
}
/** Partial interface for Mocha's `Runner` class. */
interface MochaRunner { }
interface MochaContextDefinition {
(description: string, spec: () => void): MochaSuite;
only(description: string, spec: () => void): MochaSuite;
skip(description: string, spec: () => void): void;
timeout(ms: number): void;
}
interface MochaTestDefinition {
state: 'failed' | 'passed';
(expectation: string, assertion?: ActionFunction): MochaTest;
only(expectation: string, assertion?: ActionFunction): MochaTest;
skip(expectation: string, assertion?: ActionFunction): void;
timeout(ms: number): void;
}
export namespace reporters {
export class Base {
public stats: {
suites: number;
tests: number;
passes: number;
pending: number;
failures: number;
};
constructor(runner: MochaRunner);
}
export class Doc extends Base { }
export class Dot extends Base { }
export class HTML extends Base { }
export class HTMLCov extends Base { }
export class JSON extends Base { }
export class JSONCov extends Base { }
export class JSONStream extends Base { }
export class Landing extends Base { }
export class List extends Base { }
export class Markdown extends Base { }
export class Min extends Base { }
export class Nyan extends Base { }
export class Progress extends Base {
/**
* @param options.open String used to indicate the start of the progress bar.
* @param options.complete String used to indicate a complete test on the progress bar.
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
* @param options.close String used to indicate the end of the progress bar.
*/
constructor(runner: MochaRunner, options?: {
open?: string;
complete?: string;
incomplete?: string;
close?: string;
});
}
export class Spec extends Base { }
export class TAP extends Base { }
export class XUnit extends Base {
constructor(runner: MochaRunner, options?: any);
}
}
}