-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fail when passing undefined as the expectation for equals #87
Conversation
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.
LGTM
@mgred LGTM is not a discussion 😆 Do you think it's a good idea to introduce this? Are there other cases that come to your mind? |
In my opinion, it is our responsibility as library stewards to guide users away from making mistakes, where we can reasonably detect them. If the author actually want to compare I think it would be nice if we changed the API a bit, and added |
I agree with the |
Let's put this PR and #89 in the same major version. |
Yep. I already created the |
I just saw that |
Purpose (TL;DR) - mandatory
This is up for discussion. It's a breaking change and I'm not 100% sure about it.
I noticed that
assert.equals(foo.property, bar.property)
would pass if both properties are not defined, although it's unlikely that this meets my expectation.This change throws if the expectation is
undefined
with a message recommending the use ofassert.defined
orrefute.defined
instead.What are your thoughts on this? If we want to try to protect against cases like these, are there other assertions that should be changed as well?
How to verify - mandatory
npm install
npm t
Checklist for author
npm run lint
passes