-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Labels
Description
Clear and concise description of the problem
In Vitest tests you can do this:
expect('b').toBeOneOf(['a','b','c','d']);but not this:
const values = new Set(['a','b','c','d']);
expect('b').toBeOneOf(values);You get this error: TypeError: You must provide an array to expect(received).toBeOneOf(expected), not 'object'.
Suggested solution
I think toBeOneOf is a classic Set operation and I think Vitest should support it. I think the implementation should be very straightforward and I am happy to provide a PR for it.
Alternative
There are simple workarounds of course, as you can just do this:
expect('b').toBeOneOf([...values]);(I had to do this at work recently)
But I don't see a reason why Vitest should not just support this out of the box.
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.