diff --git a/flow-typed/npm/mocha_vx.x.x.js b/flow-typed/npm/mocha_vx.x.x.js index b7c7c13128..f83b48a0b1 100644 --- a/flow-typed/npm/mocha_vx.x.x.js +++ b/flow-typed/npm/mocha_vx.x.x.js @@ -31,44 +31,44 @@ declare interface $npm$mocha$Suite { fullTitle(): string; } -declare interface $npm$mocha$ContextDefinition { +declare type $npm$mocha$ContextDefinition = {| ( description: string, callback: () => /* this: $npm$mocha$SuiteCallbackContext */ void, - ): $npm$mocha$Suite; + ): $npm$mocha$Suite, only( description: string, callback: () => /* this: $npm$mocha$SuiteCallbackContext */ void, - ): $npm$mocha$Suite; + ): $npm$mocha$Suite, skip( description: string, - callbac: () => /* this: $npm$mocha$SuiteCallbackContext */ void, - ): void; - timeout(ms: number): void; -} + callback: () => /* this: $npm$mocha$SuiteCallbackContext */ void, + ): void, + timeout(ms: number): void, +|}; -declare interface $npm$mocha$TestDefinition { +declare type $npm$mocha$TestDefinition = {| ( expectation: string, callback?: ( /* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done, ) => mixed, - ): $npm$mocha$Test; + ): $npm$mocha$Test, only( expectation: string, callback?: ( /* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done, ) => mixed, - ): $npm$mocha$Test; + ): $npm$mocha$Test, skip( expectation: string, callback?: ( /* this: $npm$mocha$TestCallbackContext, */ done: $npm$mocha$done, ) => mixed, - ): void; - timeout(ms: number): void; - state: 'failed' | 'passed'; -} + ): void, + timeout(ms: number): void, + state: 'failed' | 'passed', +|}; declare interface $npm$mocha$Runner {} @@ -208,98 +208,109 @@ declare var xit: $npm$mocha$TestDefinition; declare var test: $npm$mocha$TestDefinition; declare var specify: $npm$mocha$TestDefinition; -declare function run(): void; +type Run = () => void; -declare function setup( +declare var run: Run; + +type Setup = ( callback: ( /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function teardown( +) => void; +type Teardown = ( callback: ( /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function suiteSetup( +) => void; +type SuiteSetup = ( callback: ( /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function suiteTeardown( +) => void; +type SuiteTeardown = ( callback: ( /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function before( +) => void; +type Before = ( callback: ( /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function before( - description: string, +) => + | void + | (( + description: string, + callback: ( + /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, + ) => mixed, + ) => void); +type After = ( callback: ( /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function after( - callback: ( - /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, - ) => mixed, -): void; -declare function after( - description: string, - callback: ( - /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, - ) => mixed, -): void; -declare function beforeEach( - callback: ( - /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, - ) => mixed, -): void; -declare function beforeEach( - description: string, +) => + | void + | (( + description: string, + callback: ( + /* this: $npm$mocha$HookCallbackContext, */ done: $npm$mocha$done, + ) => mixed, + ) => void); +type BeforeEach = ( callback: ( /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function afterEach( +) => + | void + | (( + description: string, + callback: ( + /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, + ) => mixed, + ) => void); +type AfterEach = ( callback: ( /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, ) => mixed, -): void; -declare function afterEach( - description: string, - callback: ( - /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, - ) => mixed, -): void; +) => + | void + | (( + description: string, + callback: ( + /* this: $npm$mocha$BeforeAndAfterContext, */ done: $npm$mocha$done, + ) => mixed, + ) => void); + +declare var setup: Setup; +declare var teardown: Teardown; +declare var suiteSetup: SuiteSetup; +declare var suiteTeardown; +declare var before: Before; +declare var after: After; +declare var beforeEach: BeforeEach; +declare var afterEach: AfterEach; declare module 'mocha' { - declare export var mocha: typeof mocha; - declare export var describe: typeof describe; - declare export var xdescribe: typeof xdescribe; - declare export var context: typeof context; - declare export var suite: typeof suite; - declare export var it: typeof it; - declare export var xit: typeof xit; - declare export var test: typeof test; - declare export var specify: typeof specify; + declare export var mocha: $npm$mocha$TestDefinition; + declare export var describe: $npm$mocha$ContextDefinition; + declare export var xdescribe: $npm$mocha$ContextDefinition; + declare export var context: $npm$mocha$ContextDefinition; + declare export var suite: $npm$mocha$ContextDefinition; + declare export var it: $npm$mocha$TestDefinition; + declare export var xit: $npm$mocha$TestDefinition; + declare export var test: $npm$mocha$TestDefinition; + declare export var specify: $npm$mocha$TestDefinition; - declare export var run: typeof run; + declare export var run: Run; - declare export var setup: typeof setup; - declare export var teardown: typeof teardown; - declare export var suiteSetup: typeof suiteSetup; - declare export var suiteTeardown: typeof suiteTeardown; - declare export var before: typeof before; - declare export var before: typeof before; - declare export var after: typeof after; - declare export var after: typeof after; - declare export var beforeEach: typeof beforeEach; - declare export var beforeEach: typeof beforeEach; - declare export var afterEach: typeof afterEach; - declare export var afterEach: typeof afterEach; + declare export var setup: Setup; + declare export var teardown: Teardown; + declare export var suiteSetup: SuiteSetup; + declare export var suiteTeardown: SuiteTeardown; + declare export var before: Before; + declare export var after: After; + declare export var beforeEach: BeforeEach; + declare export var afterEach: AfterEach; declare export default $npm$mocha$Mocha; }