You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is really a bug or not, but since docs talk about jest and vitest compability this is one area I ran into that seems to be the exception. Basically jest allows you to specify the keys in an array instead as talked about here. The edge case I ran into is mainly the fact that a key has a dot in it (key is a domain name) so when we pass the domain name to the toHaveProperty function it tries to get the property deeply that doesn't exist. Solution Jest has is to wrap it in an array but then we get, the argument to property must be string when using nested syntax which seems to be from chai itself.
Reproduction
test('to Have Property can receive an error',()=>{constdomainKey='somedomain.com'constobject={[domainKey]: 'foo'}expect(object).toHaveProperty([domainKey],'foo')});
Describe the bug
Not sure if this is really a bug or not, but since docs talk about jest and vitest compability this is one area I ran into that seems to be the exception. Basically jest allows you to specify the keys in an array instead as talked about here. The edge case I ran into is mainly the fact that a key has a dot in it (key is a domain name) so when we pass the domain name to the toHaveProperty function it tries to get the property deeply that doesn't exist. Solution Jest has is to wrap it in an array but then we get,
the argument to property must be string when using nested syntax
which seems to be from chai itself.Reproduction
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: