From 11b670fa4eddd6b215594ad10364870e63e44d2a Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Wed, 12 Sep 2018 15:20:39 -0400 Subject: [PATCH] adds before/after mocha hooks --- x-pack/typings/mocha.d.ts | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 x-pack/typings/mocha.d.ts diff --git a/x-pack/typings/mocha.d.ts b/x-pack/typings/mocha.d.ts new file mode 100644 index 0000000000000..7e54b251d9895 --- /dev/null +++ b/x-pack/typings/mocha.d.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +// Type definitions for mocha 5.2 +// Project: http://mochajs.org/ +// Definitions by: Kazi Manzur Rashid +// otiai10 +// jt000 +// Vadim Macagon +// Andrew Bradley +// Dmitrii Sorin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare namespace Mocha { + + + // #region Test interface augmentations + + interface HookFunction { + /** + * [bdd, qunit, tdd] Describe a "hook" to execute the given callback `fn`. The name of the + * function is used as the name of the hook. + * + * - _Only available when invoked via the mocha CLI._ + */ + (fn: any): void; + + /** + * [bdd, qunit, tdd] Describe a "hook" to execute the given callback `fn`. The name of the + * function is used as the name of the hook. + * + * - _Only available when invoked via the mocha CLI._ + */ + (fn: any): void; + + /** + * [bdd, qunit, tdd] Describe a "hook" to execute the given `title` and callback `fn`. + * + * - _Only available when invoked via the mocha CLI._ + */ + (name: string, fn?: any): void; + + /** + * [bdd, qunit, tdd] Describe a "hook" to execute the given `title` and callback `fn`. + * + * - _Only available when invoked via the mocha CLI._ + */ + (name: string, fn?: any): void; + } + + /** + * Execute after running tests. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#after + */ + let after: HookFunction; + + + /** + * Execute before running tests. + * + * - _Only available when invoked via the mocha CLI._ + * + * @see https://mochajs.org/api/global.html#before + */ + let before: HookFunction; +} + +declare module "mocha" { + export = Mocha; +} + +declare const before: Mocha.HookFunction; +declare const after: Mocha.HookFunction; \ No newline at end of file