We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The property matcher behaves not consistently for undefined values
var obj = { x: undefined, y: 1} expect(obj).to.have.property('x') // not pass
but checking like this:
expect(Object.getOwnPropertyNames(obj)).to.contain('x') // pass
The text was updated successfully, but these errors were encountered:
Hey @BlackSonic thanks for the issue.
This issue is actually a duplicate of #184 - which was fixed in Chai 2.0.0. It was fixed in PR #308 if you're curious.
Here's a code sample of it working in Chai 2.0.0:
> var obj = { x: undefined, y: 1} undefined > expect(obj).to.have.property('x') { __flags: { ssfi: [Function], object: undefined, message: undefined } }
Also, if you need the behaviour to work for older version of chai, you can opt to use the ownProperty assertion instead, I believe.
ownProperty
expect(obj).to.have.ownProperty('x')
ownProperty doesn't pass the property value over though, so you cannot chain it in the same way.
I'm going to close this issue - because of the above. If you still feel it is a problem, let me know and I'll reopen it 😄
Sorry, something went wrong.
thanks, upgrading to new version solved the issue
No branches or pull requests
The property matcher behaves not consistently for undefined values
but checking like this:
The text was updated successfully, but these errors were encountered: