-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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/to equal undefined comparison #7111
Fix/to equal undefined comparison #7111
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Can you check failing tests?
{ | ||
- "x": "bar", | ||
- "y": undefined, | ||
+ "x": "foo", | ||
}", |
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.
I think the desired diff for toEqual
is to drop y: undefined
since its existance doesn't affect toEqual
assertion.
{
- "x": "bar",
+ "x": "foo",
}
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.
I have added an additional filterUndefined
function which should get the job done
I will create a new PR for this. |
Fixes #7083
Description
This PR fixes the toEqual matcher to consistently ignore undefined properties when comparing objects. Previously, undefined properties were inconsistently highlighted in error messages, leading to confusion. The fix ensures predictable behavior and clearer error messages. Unit tests have been added to validate the changes.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.