-
-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
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
an
language chain affects length
language chain?
#562
Comments
Hey @benmosher sorry for the late reply. You're totally right this does seem to be an issue. It looks as though This seems to be to do with how the chain is formed. All normal methods just return > chai.expect([1, 2, 3]).to.be.an.instanceof(Array)
[Function: assert]
> chai.expect([1, 2, 3]).to.be.instanceof(Array)
Assertion {
__flags: { ssfi: [Function], object: [ 1, 2, 3 ], message: undefined } } I'm not entirely sure how we can fix this, certainly without sweeping architectural changes. We could change how return result === undefined ? transferFlags(new chai.Assertion()) : result I'm not entirely sure that would work though. It'd certainly need lots of extra tests to back it up. I'll mark this as |
Fair enough. I'm not sure if I'll have bandwidth to attack this, especially given the simplicity of the workaround (just don't chain Mostly wanted to get it documented for others, as it was pretty surprising when one of my teammates stumbled onto it. |
Totally understandable. I'll leave it open should you or anyone else want to tackle it. |
I'm gonna take some time this week to take a look at this and report back as soon as I've explored possible solutions. I'm also available to help if anyone is already working on this (and if they do want help, of course). |
I'm having this problem, too. This is broken:
However, this works (and is the workaround I'm using for now):
Curiously, if either the |
FWIW, I've just started using I might even go so far as advocating the deprecation + removal of the |
Actually, just noticed this in the API docs:
What happened to this? |
@benmosher that notice is slightly different - that refers to calling |
Hello guys, I've just fixed this thanks to @keithamus idea. I followed his suggestions (which were great by the way, because it enabled us to keep things simple) and made some (very) minor adjustments. I will raise a PR as soon as I've got some tests to cover it up. |
Ahhhh, that makes sense, thanks. 😄 |
Note: This has been partially solved at #642. Please read that PR for more details. @keithamus should we close this or not, as it has been partially solved? |
I think this has been as solved as we can for now, so we'll close it 😄 |
Chai 3.4.1, Node 4.2.2:
... should work, but fails because
length
returns0
.Removing
an
from the chain, leaving:works as expected.
Seems similar to an issue reported late in #427 by valscion.
The text was updated successfully, but these errors were encountered: