-
-
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
feat(expect): add toSatisfy
asymmetric matcher
#7022
feat(expect): add toSatisfy
asymmetric matcher
#7022
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. |
Asymmetric matchers are added automatically if the new assertions is extended with expect.extend({
toSatisfy() { /* ... */ }
})
expect(22).toSatisfy(() => 22)
expect(22).toEqual(expect.toSatisfy(() => 22)) |
This started to fail tests after merge to |
Ah, it's because of #7043. We should also updated the diff here |
Description
I just noticed jest-extended has this https://jest-extended.jestcommunity.dev/docs/matchers/toSatisfy Note that we already have assertion form
expect(...).toSatisfy(...)
(which uses chai's `.to.satisfy), but there wasn't asymmetric matcher.One use case this would help is for error assertions like mentioned in
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:
.