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

feat: add expect.addEqualityTesters API #4586

Closed
wants to merge 28 commits into from
Closed

feat: add expect.addEqualityTesters API #4586

wants to merge 28 commits into from

Conversation

eryue0220
Copy link
Contributor

Description

Fix: #4520

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:.

Copy link

netlify bot commented Nov 24, 2023

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
🔨 Latest commit a6fb5fd
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/659412c5c3142f00089568aa
😎 Deploy Preview https://deploy-preview-4586--fastidious-cascaron-4ded94.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.

@@ -892,3 +893,87 @@ it('correctly prints diff with asymmetric matchers', () => {
})

it('timeout', () => new Promise(resolve => setTimeout(resolve, 500)))

describe.only('custom equality testers', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

you probably forgot to remove the .only on this one 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohhh, Thanks~

…t into feat/jest-custom-testers

* 'feat/jest-custom-testers' of github.com:eryue0220/vitest:
  feat: add --project option to limit what projects are running (#4561)
  fix(spy) Fix: vi.spyOn() Compatibility with Google APIs (#3141) (#3670)
@eryue0220 eryue0220 requested a review from ghiscoding November 26, 2023 08:30
docs/api/expect.md Outdated Show resolved Hide resolved
docs/api/expect.md Show resolved Hide resolved
…t into feat/jest-custom-testers

* 'feat/jest-custom-testers' of github.com:eryue0220/vitest:
  fix(vitest): correctly support CSS variable when using happy-dom (#4601)
  fix: date prototype when using setSystemTime (#4584)
  fix: respect trailing slash when filtering by file path (#4538)
  docs: correction to configuration parameter (#4587)
  chore(deps): update dependency @iconify-json/logos to ^1.1.39 (#4596)
  chore(deps): update dependency @iconify-json/carbon to ^1.1.22 (#4595)
  chore(deps): update dependency @antfu/ni to ^0.21.10 (#4594)
  fix(runner): preserve fixtures when calling runif and skipif (fix #4585) (#4591)
  chore(deps): update dependency @types/jsdom to ^21.1.6 (#4597)
  fix(vitest): Add import-meta.d.ts (#4571)
  fix(browser): allow for `pretty-format` as a sibling dependency (#4590)
@eryue0220
Copy link
Contributor Author

Hi @sheremet-va is there any idea about the CI? It always fails with time out.

)
}

setState({ customTesters: [...testers] }, (globalThis as any)[GLOBAL_EXPECT])
Copy link
Member

Choose a reason for hiding this comment

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

This breaks compatibility with Jest, there it doesn't override testers, but pushes a new one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks~ Done

@eryue0220 eryue0220 marked this pull request as draft December 21, 2023 02:32
@eryue0220 eryue0220 marked this pull request as ready for review December 22, 2023 02:40
@sheremet-va sheremet-va added this to the 1.2.0 milestone Jan 2, 2024
@tigranmk
Copy link
Contributor

tigranmk commented Jan 8, 2024

@eryue0220 Could you please take a look at #4880, it is dublicate of this PR but with some differences.

  1. Here you have not added customTesters inside arrayContaining and objectContaining asymetric matchers.
  2. As we already have JEST_MATCHERS_OBJECT, maybe it make sense to add customEqualityTesters inside it ?

@eryue0220
Copy link
Contributor Author

@eryue0220 Could you please take a look at #4880, it is dublicate of this PR but with some differences.

  1. Here you have not added customTesters inside arrayContaining and objectContaining asymetric matchers.
  2. As we already have JEST_MATCHERS_OBJECT, maybe it make sense to add customEqualityTesters inside it ?

Yeah, I've checked the PR, and you're right. I'll close this pr.

@eryue0220 eryue0220 closed this Jan 8, 2024
@sheremet-va sheremet-va removed this from the 1.2.0 milestone Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jest Compat: add expect.addEqualityTesters API
5 participants