You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
For example, DOMExceptions with standardized name prop (but no standardized message prop):
// callback form `(err: E) => boolean`assertRejects(()=>newPromise((_,rej)=>{consts=AbortSignal.timeout(0)s.onabort=()=>rej(s.reason)}),DOMException,(x)=>x.name==='TimeoutError')
Or custom error classes that don't use message:
classCustomErrorextendsError{readonlycode: numberconstructor(code: number){super()this.code=code}}// property bag form `{ [K in keyof E]: E[K] }`assertThrows(()=>{thrownewCustomError(-1)},CustomError,{code: -1})
Describe the solution you'd like
Allow checking properties of the thrown error other than message, e.g. with an optional errorCheck parameter.
Describe alternatives you've considered
How does this argument fit into the current (overloaded) function signatures?
Which form is better — callback, property bag, both, something else?
Callback is significantly more customizable (e.g. arbitrary checking of nested properties, more sophisticated checking of message prop such as exact match or regex match)
If supporting property bag, would need to decide how to check equality of nested data, possibly requiring an added dependency on assert/equal
The text was updated successfully, but these errors were encountered:
I guess this would also needed to be added to assertIsError, so the param would be string | RegExp | ((err: E) => boolean) (and/or { [K in keyof E]: E[K] }).
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
For example,
DOMException
s with standardizedname
prop (but no standardizedmessage
prop):Or custom error classes that don't use
message
:Describe the solution you'd like
Allow checking properties of the thrown error other than
message
, e.g. with an optionalerrorCheck
parameter.Describe alternatives you've considered
message
prop such as exact match or regex match)assert/equal
The text was updated successfully, but these errors were encountered: