diff --git a/jest/index.d.ts b/jest/index.d.ts index 9f945ba426..4129dcc846 100644 --- a/jest/index.d.ts +++ b/jest/index.d.ts @@ -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 , Ivo Stratev , jwbay , Alexey Svetliakov // 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. */ diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts index a3d84a09e3..6cfff857eb 100644 --- a/jest/jest-tests.ts +++ b/jest/jest-tests.ts @@ -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'); }); });