mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-24 11:50:59 +08:00
Correct signature of toThrowError
Jasmine expects an Error TYPE not an Error VALUE as first parameter.
This commit is contained in:
1 parent
9f0f926a12
commit
3379a63609
2 files changed
+12
-1
No files matched your search
@@ -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