Open ThomWright opened 8 years ago
Hey @ThomWright thanks for the issue.
This does seem to be a problem. I'd welcome a PR to fix this if you have the time :smile:
This is sad :(
PR sent. The Travis build failed, but it seems to be because it hasn't been configured and is trying to build a Ruby project.
This might be a breaking change, but perhaps instead of using the word all, you use the word each.
expect(collection).to.each.have.property("foo", "bar")
instead of
expect(collection).to.each.have.property("foo", "bar")
This makes more sense grammatically as well.
:+1: That would probably be a better solution.
I’ve exactly the same problem. The key
/keys
assertion isn’t usable at all if chai-things
is used.
I agree that each is more intuitive than all, seems like a decent idea. You could even make it work for object values.
A workaround for this is omit writing "all", since chai defaults to using it anyway. From the chai docs:
Note, either any or all should be used in the assertion. If neither are used, the assertion is defaulted to all. [1]
I tried to fix this. I might have gotten a bit overaggressive with it though.
Side effects include allowing testing over enumerable object properties and the inclusion of synonym 'each'
Nice!
Get unexcited. It's clear there are some implementation decisions in this module which are at odds with the chai implementations.
The 'contains' flag interaction is mandatory for 'any' and has no effect on 'all'
however in default chai the behavior is 'contains' has no effect on 'any', but determines whether 'all' is inclusive or comprehensive.
There is also a difference between the included chai package and most up to date package of chai.
Okay. It's ready again. Whew.
I would like to ask for news of the issue ^^
Seems it doesn't work at all.
It's pretty bad that this is 4+ years old. Just used chai-things
and now have to revert. Didn't notice it wasn't maintained
If they aren't going to maintain this plugin it needs to be marked as archived and alternatives given for its use cases.
Sadly the broken example of this still exists in the Chai documentation: https://www.chaijs.com/api/bdd/#method_all
Chai's built-in
all.keys
assertions seem to break when I usechai-things
- Chai keysAssertionError: expected { Object (a, b, ...) } to have a property 'length'