-
Notifications
You must be signed in to change notification settings - Fork 69
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
Official length
workaround doesn't work
#30
Comments
New workaround, for the terminal variation of FWIW the function it's complaining about and spitting out in the error message is the |
Rolling back chai to 1.4.0 has no effect... I'm at a loss to explain why the workaround would have ever worked, given that |
It may well be that it never did work. I should've added it to the test suite when it was first proposed, but neglected to. |
Only real work around my team has found is to not use length at all. And instead do |
chai-jquery's |
@nackjicholson I prefer I find that version way more readable in case of failure (Failure will read |
I'm getting the same error with: expect($('.foo')).to.have('h1'); TypeError: '[object Object]' is not a function (evaluating 'expect($('.foo')).to.have('h1')') |
I ended up opting for:
|
My issue was actually an issue with installing Chai Jquery into Karma. Now, my original expression works just fine. |
|
@jedmao: what exactly was the issue having the same prob with a mocha setup |
@gumaflux my issue was with both syntaxes. The first isn't officially supported, so that shouldn't be a surprise: expect(selection).to.have.length(2); The second, however, was explicitly stated in the documentation as a workaround: expect(selection).to.be.of.length(2); This also doesn't work. The way I'm doing it now is pretty much as @nackjicholson has stated: expect(selection.length).to.eq(2); This is the only way I've gotten it to work. I'm sure the other ways expressed above work also, but I'm not interested in those syntaxes. BTW @jfirebaugh, I can confirm that this workaround does, in fact, NOT work! I would love it if it did :) |
👍 more descriptive error messages than "expected 2 to equal 1" would be very nice. |
@jedmao great thanks |
@gumaflux my co-worker had success with the following syntax as well: expect(selection.length).to.be(2); |
Fixed by #47. |
About to dig deeper into this, but the
be.of.length(x)
workaround forhave.length(x)
no longer seems to work.I just cloned fresh,
npm install
ed and added a single test forAnd get the following failure:
I get a different error in Safari:
I suppose it's possible there's something wrong with my setup, but I don't see what it could be...
The text was updated successfully, but these errors were encountered: