From 3dee137d82c7f6ccb4a601aa1b7d121debb0d6ee Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Fri, 21 Feb 2020 21:12:43 +0100 Subject: [PATCH] =?UTF-8?q?fix(mocha=E2=80=91sugar=E2=80=91free):=20Correc?= =?UTF-8?q?t=C2=A0`Options`=C2=A0type=20(#42532)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/mocha-sugar-free/index.d.ts | 33 +++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/types/mocha-sugar-free/index.d.ts b/types/mocha-sugar-free/index.d.ts index ac8c6936a8..7c5a865776 100644 --- a/types/mocha-sugar-free/index.d.ts +++ b/types/mocha-sugar-free/index.d.ts @@ -9,17 +9,24 @@ import { Test, Suite } from 'mocha'; type Omit = Pick>; declare namespace Mocha { - type TestCase = (this: undefined, context: TestContext) => void | PromiseLike; + type TestCase = (this: undefined, context: TestContext) => void | PromiseLike; type TestCaseWithDone = (this: undefined, context: TestContextWithDone) => void; type HookFunc = (this: undefined, context: HookContext) => void; type SuiteFunc = (this: undefined, context: SuiteContext) => void; interface Options { + [option: string]: any; + /** * Whether the context should contain a `done` callback. */ async?: boolean; + /** + * Set whether timeouts are enabled. + */ + enableTimeouts?: boolean; + /** * Whether failing to return a PromiseLike should fail the test. */ @@ -45,6 +52,16 @@ declare namespace Mocha { */ skipUnlessBrowser?: boolean; + /** + * Set test slowness threshold. + */ + slow?: string | number; + + /** + * Set test timeout. + */ + timeout?: string | number; + /** * The test title. Replaced by the title parameter if present. */ @@ -319,7 +336,7 @@ declare namespace Mocha { /** * Mark a test as completed. */ - done(err: any): void; + done(err?: any): void; } // #endregion @@ -404,10 +421,10 @@ declare namespace Mocha { (fn: TestCase): Test; (title: string, fn?: TestCase): Test; (title: string, options: Options & { async?: false; fn?: TestCase }, fn?: TestCase): Test; - (title: string, options: Options & { async?: true; fn?: TestCase }, fn?: TestCaseWithDone): Test; + (title: string, options: Options & { async: true; fn?: TestCaseWithDone }, fn?: TestCaseWithDone): Test; // tslint:disable-next-line: unified-signatures (options: Options & { async?: false; fn?: TestCase }, fn?: TestCase): Test; - (options: Options & { async?: true; fn?: TestCase }, fn?: TestCaseWithDone): Test; + (options: Options & { async: true; fn?: TestCaseWithDone }, fn?: TestCaseWithDone): Test; /** * [bdd, tdd, qunit] @@ -437,10 +454,10 @@ declare namespace Mocha { (fn: TestCase): Test; (title: string, fn?: TestCase): Test; (title: string, options: Options & { async?: false; fn?: TestCase }, fn?: TestCase): Test; - (title: string, options: Options & { async?: true; fn?: TestCase }, fn?: TestCaseWithDone): Test; + (title: string, options: Options & { async: true; fn?: TestCaseWithDone }, fn?: TestCaseWithDone): Test; // tslint:disable-next-line: unified-signatures (options: Options & { async?: false; fn?: TestCase }, fn?: TestCase): Test; - (options: Options & { async?: true; fn?: TestCase }, fn?: TestCaseWithDone): Test; + (options: Options & { async: true; fn?: TestCaseWithDone }, fn?: TestCaseWithDone): Test; } /** @@ -456,10 +473,10 @@ declare namespace Mocha { (fn: TestCase): Test; (title: string, fn?: TestCase): Test; (title: string, options: Options & { async?: false; fn?: TestCase }, fn?: TestCase): Test; - (title: string, options: Options & { async?: true; fn?: TestCase }, fn?: TestCaseWithDone): Test; + (title: string, options: Options & { async: true; fn?: TestCaseWithDone }, fn?: TestCaseWithDone): Test; // tslint:disable-next-line: unified-signatures (options: Options & { async?: false; fn?: TestCase }, fn?: TestCase): Test; - (options: Options & { async?: true; fn?: TestCase }, fn?: TestCaseWithDone): Test; + (options: Options & { async: true; fn?: TestCaseWithDone }, fn?: TestCaseWithDone): Test; } // #endregion }