vitest
vitest copied to clipboard
fix(expect)!: loosen `toMatchObject` and `objectContaining` for `Proxy.get`
Description
- closes https://github.com/vitest-dev/vitest/issues/6672
I'm not sure if this behavior is the best, but I'm creating a PR to test a few things.
Technically this is a breaking change since people might be using negating expect(someProxy).not.toMatchObject({ ... }) to assert proxy keys not being there.
pros
- convenient for testing
Proxy.get toMatchObject/objectContainingalready allows testing non-enumerable properties (e.g.Error.cause)
cons
Proxy.getwon't give better diff since non-enumerable- breaking change
- no jest compat
todo
- [ ] docs to explain what type of properties (enumerable vs. non-enumerable) are considered for
toEqual,toMatchObject, etc... also diff format
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] 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.yamlunless 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 docscommand.
Changesets
- [x] 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:, orchore:.
Deploy Preview for vitest-dev ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | f0ca9a31132ef3df3b92e801ff07610ed82212e7 |
| Latest deploy log | https://app.netlify.com/sites/vitest-dev/deploys/6707487c57cccd0008c90756 |
| Deploy Preview | https://deploy-preview-6675--vitest-dev.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Closing as par https://github.com/vitest-dev/vitest/issues/6672#issuecomment-2521919672