mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
Fix definitions of “throw” and “throwError”
This commit is contained in:
4
types/should/index.d.ts
vendored
4
types/should/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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.*/);
|
||||
|
||||
Reference in New Issue
Block a user