Jest: toThrow supports same signature as toThrowError, bump to 19.0.2

This commit is contained in:
Jay Phelps
2017-02-25 00:43:31 -08:00
parent 7132f08a39
commit b1e059c00b
2 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Jest 18.1.0
// Type definitions for Jest 19.2.0
// Project: http://facebook.github.io/jest/
// Definitions by: Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -229,7 +229,7 @@ declare namespace jest {
/** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */
toMatchSnapshot(snapshotName?: string): void;
/** Used to test that a function throws when it is called. */
toThrow(): void;
toThrow(error?: string | Constructable | RegExp): void;
/** If you want to test that a specific error is thrown inside a function. */
toThrowError(error?: string | Constructable | RegExp): void;
/** Used to test that a function throws a error matching the most recent snapshot when it is called. */
+4
View File
@@ -160,17 +160,21 @@ describe('toThrow API', function () {
it('throws', function () {
expect(throwTypeError()).toThrow();
expect(throwTypeError()).toThrowError();
});
it('throws TypeError', function () {
expect(throwTypeError()).toThrow(TypeError);
expect(throwTypeError()).toThrowError(TypeError);
});
it('throws \'Definition was out of date\'', function () {
expect(throwTypeError()).toThrow(/Definition was out of date/);
expect(throwTypeError()).toThrowError(/Definition was out of date/);
});
it('throws \'toThorow Definition was out of date\'', function () {
expect(throwTypeError()).toThrow('toThrow Definition was out of date');
expect(throwTypeError()).toThrowError('toThrow Definition was out of date');
});
});