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
{{ message }}
Repository navigation
assert.rejects passes if the given function throws synchronously #19646
This is unexpected because I would expect assert.rejects to check that the given function returns a Promise which eventually rejects. In this case, no Promise is returned at all, so there is nothing that "rejects".
From an ergonomics perspective, if I were writing a function which could return a rejected Promise, I would want to always return a Promise to indicate errors, rather than sometimes throwing synchronously. If my function did throw synchronously rather than rejecting, this would be incorrect behavior and I would expect assert.rejects to report the error.
Activity
assert: ensure .rejects() disallows sync throws
assert: ensure .rejects() disallows sync throws
assert: ensure .rejects() disallows sync throws