Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Oct 31, 2024

Description

This is breaking (making equality stricter in most cases) but this behavior probably makes more sense.

Examples

Following assertions previously passed but now it fails.

expect([new Set(['x'])]).toEqual(
  expect.arrayContaining([new Set(['y'])]),
)
expect({ foo: new Set(['x']) }).toEqual(
  expect.objectContaining({ foo: new Set(['y']) }),
)

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link

netlify bot commented Oct 31, 2024

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit abed2de
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6722e3729b52430008792bfa
😎 Deploy Preview https://deploy-preview-6825--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@hi-ogawa hi-ogawa changed the title fix(expect): pass current equality testers to asymmetric matcher fix(expect)!: pass current equality testers to asymmetric matcher Oct 31, 2024
@hi-ogawa hi-ogawa marked this pull request as ready for review October 31, 2024 02:06
@hi-ogawa hi-ogawa added this to the 3.0.0 milestone Dec 14, 2024
@hi-ogawa hi-ogawa added the p2-to-be-discussed Enhancement under consideration (priority) label Dec 20, 2024
@hi-ogawa hi-ogawa modified the milestones: 3.0.0, 4.0.0 Jan 15, 2025
@sheremet-va sheremet-va added breaking change p3-significant High priority enhancement (priority) and removed p2-to-be-discussed Enhancement under consideration (priority) labels Jan 17, 2025

export interface AsymmetricMatcherInterface {
asymmetricMatch: (other: unknown) => boolean
asymmetricMatch: (other: unknown, customTesters?: Array<Tester>) => boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: see if we can keep the API same without extending arguments.

@sheremet-va
Copy link
Member

@hi-ogawa can you resolve conflicts, please? 👀

@sheremet-va sheremet-va merged commit 965cefc into vitest-dev:main Sep 8, 2025
13 of 14 checks passed
@hi-ogawa hi-ogawa deleted the fix-testers-for-asymmetric-matcher branch September 9, 2025 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change p3-significant High priority enhancement (priority)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Set comparison within expect.objectContaining fails

2 participants