New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix typings of toThrowWithMessage
, support unconstructable errors
#475
Conversation
Codecov Report
@@ Coverage Diff @@
## main #475 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 71 71
Lines 575 582 +7
Branches 148 148
=========================================
+ Hits 575 582 +7
Continue to review full report at Codecov.
|
toThrowWithMessage
, support unconstructable errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet, thanks!
Hi @SimenB , do you know when this will be released ? I'm heavily relying on node Thanks ! |
Thanks so much ! |
What
This PR fixes typings issues noted in #472, and adds support to unconstructable errors (such as abstract classes or not taking a
message
string as first arg) to be passed as error class.Why
See #472. Moreover,
toThrowWithMessage
was unusable withAssertionError
from the nodeassert
module.Notes
The matcher first tries to instantiate the
type
with the message (toString
ed in case it was a regex).If the instantiation fails, it creates a new
Error
on which it sets thename
&message
in order to be correctly printed as expected in the message.Housekeeping