From 2209c748eaa659374f07c23cdd66fe51f5cf6c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Wed, 16 Aug 2017 17:03:01 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20definitions=20of=20=E2=80=9Cthrow?= =?UTF-8?q?=E2=80=9D=20and=20=E2=80=9CthrowError=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/should/index.d.ts | 4 ++-- types/should/should-tests.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/should/index.d.ts b/types/should/index.d.ts index 0a5038d027..f7a192cf0e 100644 --- a/types/should/index.d.ts +++ b/types/should/index.d.ts @@ -91,7 +91,7 @@ interface ShouldAssertion { enumerables(...properties: string[]): ShouldAssertion; startWith(expected: string, message?: any): ShouldAssertion; endWith(expected: string, message?: any): ShouldAssertion; - throw(message?: any): ShouldAssertion; + throw(message?: any, properties?: Object): ShouldAssertion; //promises eventually: ShouldAssertion; @@ -137,7 +137,7 @@ interface ShouldAssertion { deepEqual(expected: any, description?: string): ShouldAssertion; exactly(expected: any, description?: string): ShouldAssertion; instanceOf(constructor: Function, description?: string): ShouldAssertion; - throwError(message?: any): ShouldAssertion; + throwError(message?: any, properties?: Object): ShouldAssertion; lengthOf(n: number, description?: string): ShouldAssertion; key(key: string): ShouldAssertion; hasOwnProperty(name: string, description?: string): ShouldAssertion; diff --git a/types/should/should-tests.ts b/types/should/should-tests.ts index 4b4b7146b7..fc5ae922b0 100644 --- a/types/should/should-tests.ts +++ b/types/should/should-tests.ts @@ -243,6 +243,18 @@ spy.should.have.threw("ReferenceError"); throw new Error('failed to foo'); }).should.throw(/^fail/); +(function () { + throw new Error('failed to foo'); +}).should.throw(Error); + +(function () { + throw new Error('failed to foo'); +}).should.throw(Error, { message: 'failed to baz' }); + +(function () { + throw new Error('failed to foo'); +}).should.throwError(Error, { message: 'failed to baz' }); + (function () { throw new Error('failed to baz'); }).should.throwError(/^fail.*/);