Merge pull request #8431 from iplabs/jasmine

Correct signature of `toThrowError`
This commit is contained in:
Masahiro Wakame
2016-03-11 00:06:53 +09:00
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -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 () {
+1 -1
View File
@@ -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;