diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 114587446..7ce5d1239 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -150,6 +150,17 @@ describe("Included matchers:", function () { expect(foo).not.toThrow(); expect(bar).toThrow(); }); + + it("The 'toThrowError' matcher is for testing a specific thrown exception", function() { + var foo = function() { + throw new TypeError("foo bar baz"); + }; + + expect(foo).toThrowError("foo bar baz"); + expect(foo).toThrowError(/bar/); + expect(foo).toThrowError(TypeError); + expect(foo).toThrowError(TypeError, "foo bar baz"); + }); }); describe("A spec", function () { diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index f04bb2a9f..7a302e57f 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -297,7 +297,7 @@ declare module jasmine { toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; toThrow(expected?: any): boolean; toThrowError(message?: string | RegExp): boolean; - toThrowError(expected?: Error, message?: string | RegExp): boolean; + toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; not: Matchers; Any: Any;