Replies: 1 comment 5 replies
-
I am not convinced that we should allow additional arguments, but maybe we can add a new function like expect(user).toEqual({
id: expect.oneOf(expect.any(String), undefined))
}) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With
expect.any()
we can only have one type likeexpect.any(String)
. If we want to express an optional property that might benull
orundefined
, we have to use a 3rd party library.If
expect.any()
were variadic, it could be called with multiple possible types expressing a logical-OR:Making the signature variadic shouldn't break anything, but it would be a slight derivation from the Jest-style API.
Beta Was this translation helpful? Give feedback.
All reactions