Skip to content

Commit 3f6034a

Browse files
flow-typed: update Mocha typings (#2961)
1 parent eb28401 commit 3f6034a

File tree

1 file changed

+88
-77
lines changed

1 file changed

+88
-77
lines changed

flow-typed/npm/mocha_vx.x.x.js

Lines changed: 88 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,44 @@ declare interface $npm$mocha$Suite {
3131
fullTitle(): string;
3232
}
3333

34-
declare interface $npm$mocha$ContextDefinition {
34+
declare type $npm$mocha$ContextDefinition = {|
3535
(
3636
description: string,
3737
callback: () => /* this: $npm$mocha$SuiteCallbackContext */ void,
38-
): $npm$mocha$Suite;
38+
): $npm$mocha$Suite,
3939
only(
4040
description: string,
4141
callback: () => /* this: $npm$mocha$SuiteCallbackContext */ void,
42-
): $npm$mocha$Suite;
42+
): $npm$mocha$Suite,
4343
skip(
4444
description: string,
45-
callbac: () => /* this: $npm$mocha$SuiteCallbackContext */ void,
46-
): void;
47-
timeout(ms: number): void;
48-
}
45+
callback: () => /* this: $npm$mocha$SuiteCallbackContext */ void,
46+
): void,
47+
timeout(ms: number): void,
48+
|};
4949

50-
declare interface $npm$mocha$TestDefinition {
50+
declare type $npm$mocha$TestDefinition = {|
5151
(
5252
expectation: string,
5353
callback?: (
5454
/* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done,
5555
) => mixed,
56-
): $npm$mocha$Test;
56+
): $npm$mocha$Test,
5757
only(
5858
expectation: string,
5959
callback?: (
6060
/* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done,
6161
) => mixed,
62-
): $npm$mocha$Test;
62+
): $npm$mocha$Test,
6363
skip(
6464
expectation: string,
6565
callback?: (
6666
/* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done,
6767
) => mixed,
68-
): void;
69-
timeout(ms: number): void;
70-
state: 'failed' | 'passed';
71-
}
68+
): void,
69+
timeout(ms: number): void,
70+
state: 'failed' | 'passed',
71+
|};
7272

7373
declare interface $npm$mocha$Runner {}
7474

@@ -208,98 +208,109 @@ declare var xit: $npm$mocha$TestDefinition;
208208
declare var test: $npm$mocha$TestDefinition;
209209
declare var specify: $npm$mocha$TestDefinition;
210210

211-
declare function run(): void;
211+
type Run = () => void;
212212

213-
declare function setup(
213+
declare var run: Run;
214+
215+
type Setup = (
214216
callback: (
215217
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
216218
) => mixed,
217-
): void;
218-
declare function teardown(
219+
) => void;
220+
type Teardown = (
219221
callback: (
220222
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
221223
) => mixed,
222-
): void;
223-
declare function suiteSetup(
224+
) => void;
225+
type SuiteSetup = (
224226
callback: (
225227
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
226228
) => mixed,
227-
): void;
228-
declare function suiteTeardown(
229+
) => void;
230+
type SuiteTeardown = (
229231
callback: (
230232
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
231233
) => mixed,
232-
): void;
233-
declare function before(
234+
) => void;
235+
type Before = (
234236
callback: (
235237
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
236238
) => mixed,
237-
): void;
238-
declare function before(
239-
description: string,
239+
) =>
240+
| void
241+
| ((
242+
description: string,
243+
callback: (
244+
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
245+
) => mixed,
246+
) => void);
247+
type After = (
240248
callback: (
241249
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
242250
) => mixed,
243-
): void;
244-
declare function after(
245-
callback: (
246-
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
247-
) => mixed,
248-
): void;
249-
declare function after(
250-
description: string,
251-
callback: (
252-
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
253-
) => mixed,
254-
): void;
255-
declare function beforeEach(
256-
callback: (
257-
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
258-
) => mixed,
259-
): void;
260-
declare function beforeEach(
261-
description: string,
251+
) =>
252+
| void
253+
| ((
254+
description: string,
255+
callback: (
256+
/* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done,
257+
) => mixed,
258+
) => void);
259+
type BeforeEach = (
262260
callback: (
263261
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
264262
) => mixed,
265-
): void;
266-
declare function afterEach(
263+
) =>
264+
| void
265+
| ((
266+
description: string,
267+
callback: (
268+
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
269+
) => mixed,
270+
) => void);
271+
type AfterEach = (
267272
callback: (
268273
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
269274
) => mixed,
270-
): void;
271-
declare function afterEach(
272-
description: string,
273-
callback: (
274-
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
275-
) => mixed,
276-
): void;
275+
) =>
276+
| void
277+
| ((
278+
description: string,
279+
callback: (
280+
/* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done,
281+
) => mixed,
282+
) => void);
283+
284+
declare var setup: Setup;
285+
declare var teardown: Teardown;
286+
declare var suiteSetup: SuiteSetup;
287+
declare var suiteTeardown;
288+
declare var before: Before;
289+
declare var after: After;
290+
declare var beforeEach: BeforeEach;
291+
declare var afterEach: AfterEach;
277292

278293
declare module 'mocha' {
279-
declare export var mocha: typeof mocha;
280-
declare export var describe: typeof describe;
281-
declare export var xdescribe: typeof xdescribe;
282-
declare export var context: typeof context;
283-
declare export var suite: typeof suite;
284-
declare export var it: typeof it;
285-
declare export var xit: typeof xit;
286-
declare export var test: typeof test;
287-
declare export var specify: typeof specify;
294+
declare export var mocha: $npm$mocha$TestDefinition;
295+
declare export var describe: $npm$mocha$ContextDefinition;
296+
declare export var xdescribe: $npm$mocha$ContextDefinition;
297+
declare export var context: $npm$mocha$ContextDefinition;
298+
declare export var suite: $npm$mocha$ContextDefinition;
299+
declare export var it: $npm$mocha$TestDefinition;
300+
declare export var xit: $npm$mocha$TestDefinition;
301+
declare export var test: $npm$mocha$TestDefinition;
302+
declare export var specify: $npm$mocha$TestDefinition;
288303

289-
declare export var run: typeof run;
304+
declare export var run: Run;
290305

291-
declare export var setup: typeof setup;
292-
declare export var teardown: typeof teardown;
293-
declare export var suiteSetup: typeof suiteSetup;
294-
declare export var suiteTeardown: typeof suiteTeardown;
295-
declare export var before: typeof before;
296-
declare export var before: typeof before;
297-
declare export var after: typeof after;
298-
declare export var after: typeof after;
299-
declare export var beforeEach: typeof beforeEach;
300-
declare export var beforeEach: typeof beforeEach;
301-
declare export var afterEach: typeof afterEach;
302-
declare export var afterEach: typeof afterEach;
306+
declare export var setup: Setup;
307+
declare export var teardown: Teardown;
308+
declare export var suiteSetup: SuiteSetup;
309+
declare export var suiteTeardown: SuiteTeardown;
310+
declare export var before: Before;
311+
declare export var after: After;
312+
declare export var beforeEach: BeforeEach;
313+
declare export var afterEach: AfterEach;
303314

304315
declare export default $npm$mocha$Mocha;
305316
}

0 commit comments

Comments
 (0)