Skip to content
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(expect): fix error messages for toMatchObject #6228

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

IgorM867
Copy link
Contributor

@IgorM867 IgorM867 commented Dec 2, 2024

Matcher toMatchObject throws the same error message when it called with .not and without .not.

Without .not:

it("toMatchObject without not", () => {
  expect({ foo: 0 }).toMatchObject({ foo: 1 });
});

Error:

error: AssertionError: Expected {
  foo: 0,
} to NOT match {
  foo: 1,
}

With .not:

it("toMatchObject with not", () => {
  expect({ foo: 0 }).not.toMatchObject({ foo: 0 });
});

Error:

error: AssertionError: Expected {
  foo: 0,
} to NOT match {
  foo: 0,
}

Fixes #6224

@IgorM867 IgorM867 requested a review from kt3k as a code owner December 2, 2024 08:29
@github-actions github-actions bot added the expect label Dec 2, 2024
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.51%. Comparing base (2c7d7d6) to head (d745bb2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6228   +/-   ##
=======================================
  Coverage   96.51%   96.51%           
=======================================
  Files         534      534           
  Lines       40971    40976    +5     
  Branches     6133     6134    +1     
=======================================
+ Hits        39542    39549    +7     
+ Misses       1386     1385    -1     
+ Partials       43       42    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@kt3k kt3k merged commit b1b8279 into denoland:main Dec 3, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expect toMatchObject shows "expected... to NOT match"
2 participants