Skip to content

fix: improve diffs for asymmetric matchers - #11855

Merged
sheremet-va merged 3 commits into
mainfrom
fix/asymmetric-matcher-diff
Nov 4, 2026
Merged

sheremet-va merged 3 commits into
mainfrom
fix/asymmetric-matcher-diff

Conversation

@sheremet-va

@sheremet-va sheremet-va commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Fixes #5714
Fixes #8913
Fixes #11854

  • objectContaining diffs show the keys the matcher does not check as unchanged lines, also at the top level.
  • arrayContaining diffs keep the received order and show missing items as removed lines.
  • Only non-negated objectContaining/arrayContaining are unwrapped; expect.extend matchers, schemaMatching and negated matchers are printed as is.
  • toHaveBeenCalledWith, toHaveReturnedWith and similar matchers replace asymmetric matchers in their diffs.
  • Multi-line toAsymmetricMatcher() output is indented when nested.

Note on labels: a failed objectContaining/arrayContaining is now printed without its label at any depth ({ instead of ObjectContaining {), also in error.expected. Negated matchers keep their label: no value that passes them can be built, and their unchanged lines are the keys that caused the failure.

@netlify

netlify Bot commented Nov 3, 2026

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 83c613e
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6ae9f81faf933d562bbdf7b7
😎 Deploy Preview https://deploy-preview-11855--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@flakiness-io

flakiness-io Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Test Results Summary

This comment shows the latest test results for this pull request.

Commit Status Test Results CI Runs
d3e21c2 ✅ Passed 31444 passed · 234 flaky · 1180 skipped 26 runs
⚠️ 234 flaky

⚠️ win 10.0.26100 · threads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 24.04 · vmThreads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 24.04 · threads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 24.04 · threads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 24.04 · vmThreads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 24.04 · forks test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 24.04 · forks test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ win 10.0.26100 · vmThreads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ win 10.0.26100 · forks test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ win 10.0.26100 · threads test/unit/test/retry.test.ts:61 › describe object add(1, 1) › returned value not be less than 2
…and 224 more

View full report

ℹ️ About Flakiness.io in GitHub

Your team has set up Flakiness.io pull request comments. This comment is updated when

  • The first test results arrive for this pull request
  • A later run reports more results for the same commit
  • A new commit is pushed and tested

Flakiness.io rewrites the comment in place, so it always reflects the most recently tested commit.

@sheremet-va
sheremet-va merged commit 8677542 into main Nov 4, 2026
29 of 30 checks passed
@sheremet-va
sheremet-va deleted the fix/asymmetric-matcher-diff branch November 4, 2026 08:53
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

1 participant