vitest
vitest copied to clipboard
Add matcher `toIncludeSameMembers`
Clear and concise description of the problem
I often have a use-case for checking whether two arrays contain equal elements but in a different order.
Suggested solution
I found a PR for the jest-extended package, which includes an implementation of a matcher (https://github.com/jest-community/jest-extended/pull/122/files#diff-0bca30d1ed803269281ba667ea219217c02b44935f4b2391f987bd9d20ebf7d5)
There's an update request to this feature: https://github.com/jest-community/jest-extended/issues/639 and the author created a separate npm package, which also seems to work with vitest.
Alternative
- Write a custom matcher
- Search for some package which has this functionality
- Add a sorting every time I want to compare two arrays this way
- Install the npm package
expect-matchers
Additional context
No response
Validations
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.