From df41a368ac76e98ed159359ec70f1f59bebf6cf1 Mon Sep 17 00:00:00 2001 From: Boris Serdiuk Date: Sat, 17 Jul 2021 23:02:46 +0200 Subject: [PATCH] fix jasmine type definitions --- packages/allure-jasmine/test/helpers.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/allure-jasmine/test/helpers.ts b/packages/allure-jasmine/test/helpers.ts index 1b0c048a5..dae62b001 100644 --- a/packages/allure-jasmine/test/helpers.ts +++ b/packages/allure-jasmine/test/helpers.ts @@ -3,7 +3,13 @@ import { JasmineAllureReporter } from "../src/JasmineAllureReporter"; import Env = jasmine.Env; export interface JasmineTestEnv extends Env { + // These functions are not available in the public Jasmine API + // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/51999#issuecomment-832961442 + // TODO: figure out how to refactor tests without using them expect(actual: any): any; + describe(name: string, content: () => void): void; + xdescribe(name: string, content: () => void): void; + it(name: string, content: () => void): void; } export async function runTest(fun: (testEnv: JasmineTestEnv, testAllure: Allure) => void) { @@ -21,13 +27,13 @@ export async function runTest(fun: (testEnv: JasmineTestEnv, testAllure: Allure) } export function delay(ms: number) { - return new Promise(function(resolve) { + return new Promise(function (resolve) { setTimeout(resolve, ms); }); } export function delayFail(ms: number) { - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { setTimeout(() => reject(new Error("Async error")), ms); }); }