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
On one hand, sure, when the actual value is invoked, an exception is thrown. But I think this has the potential of false-positives; passing tests but it's really hiding something there. Even something like the following now has me second-guessing and desiring more validation (maybe assertingtypeof ahead of the throws check?):
I noticed that passing something like "1" into the
throws
assertion actually passes:What's actually going on is shown if you use a matcher:
Which is what is used to invoke the actual function inside a try/catch block. So this is true for really anything that isn't a function:
On one hand, sure, when the actual value is invoked, an exception is thrown. But I think this has the potential of false-positives; passing tests but it's really hiding something there. Even something like the following now has me second-guessing and desiring more validation (maybe asserting
typeof
ahead of the throws check?):I'm proposing something more explicit for this case...
As a summary spec,
throws
shall:The new item would more align with the
rejects
validation that the actual value must be a promise (or thenable).The text was updated successfully, but these errors were encountered: