From ed9b273ae4c8e954e6b5330b2d7f413a8edff5fa Mon Sep 17 00:00:00 2001 From: Roaders Date: Sat, 17 Nov 2018 00:40:01 +0000 Subject: [PATCH] Update Jasmine to 3.0 (#30261) * Update Jasmine to 3.3 * Update index.d.ts * Update index.d.ts Change targeted version to 3.0.0 as all additional matchers are in 3.0.0 as well as 3.3.0 * Update index.d.ts Remove nothing from `Matchers` * Update jasmine-tests.ts Remove nothing from tests on Matcher --- types/jasmine/index.d.ts | 7 ++++++- types/jasmine/jasmine-tests.ts | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index a25d28a715..f7bfdd470c 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jasmine 2.8.0 +// Type definitions for Jasmine 3.0.0 // Project: http://jasmine.github.io/ // Definitions by: Boris Yankov // Theodore Brown @@ -7,6 +7,7 @@ // Lukas Zech // Boris Breuer // Chris Yungmann +// Giles Roadnight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts @@ -453,6 +454,10 @@ declare namespace jasmine { toThrow(expected?: any): boolean; toThrowError(message?: string | RegExp): boolean; toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; + toThrowMatching(predicate: (thrown: any) => boolean): boolean; + toBeNegativeInfinity(expectationFailOutput?: any): boolean; + toBePositiveInfinity(expectationFailOutput?: any): boolean; + toHaveClass(expected: any, expectationFailOutput?: any): boolean; /** * Add some context for an expect. diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index 11bfbca2b2..8568e97f38 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -173,6 +173,24 @@ describe("Included matchers:", () => { }); }); +describe("toThrowMatching", () => { + expect(() => { + ({} as any).doSomething(); + }).toThrowMatching(error => error != undefined); +}); + +describe("toBeNegativeInfinity", () => { + expect("").toBeNegativeInfinity(); +}); + +describe("toBePositiveInfinity", () => { + expect("").toBePositiveInfinity(); +}); + +describe("toHaveClass", () => { + expect("").toHaveClass(Array); +}); + describe("A spec", () => { it("is just a function, so it can contain any code", () => { var foo = 0;