mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #8431 from iplabs/jasmine
Correct signature of `toThrowError`
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user