Fix jasminewd2 compatibility with older jasmine versions (#38737)

This commit is contained in:
Alex Povar
2019-10-01 18:37:37 +02:00
committed by Ben Lichtman
parent a77838da88
commit 7f3cd68ef3
2 changed files with 9 additions and 4 deletions

View File

@@ -617,9 +617,6 @@ declare namespace jasmine {
type MatchableArgs<Fn> = Fn extends (...args: infer P) => any ? { [K in keyof P]: P[K] | AsymmetricMatcher<any> } : never;
interface FunctionMatchers<Fn extends Func> extends Matchers<any> {
toHaveBeenCalled(): boolean;
toHaveBeenCalledBefore(expected: Func): boolean;
toHaveBeenCalledTimes(expected: number): boolean;
toHaveBeenCalledWith(...params: MatchableArgs<Fn>): boolean;
/**

View File

@@ -5,7 +5,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="jasmine/v2" />
/// <reference types="jasmine" />
declare function it(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
declare function fit(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
@@ -47,6 +47,14 @@ declare namespace jasmine {
not: ArrayLikeMatchers<T>;
}
// Add definition to be compatible with latest jasmine v3 types.
// Even though library is not compatible with jasmine v3, there is no suitable way to configure that now here.
// See for more detail: https://github.com/microsoft/dtslint/issues/253
interface FunctionMatchers<Fn extends (...args: any[]) => any> extends Matchers<any> {
toHaveBeenCalledWith(...params: any[]): boolean;
toHaveBeenCalledWith(...params: any[]): Promise<void>;
}
function addMatchers(matchers: AsyncCustomMatcherFactories): void;
interface Env {