-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
ok() is not a function #690
Comments
@slavafomin Thanks for the post! This has been kicked around before and was actually a feature in Chai 1.x but was later reverted due to issues. You can read about it here: #371 There is a solution for you though! Please check out the dirty-chai plugin :D |
Thanks for the hint @meeber! I will definitely use However, the idea to settle for property style definitions instead of function calls looks very weird to me, because it:
|
Hi, @slavafomin thanks for your feedback! 😄 I totally understand your concern, however if we needed to call methods instead of using getters we would need to use I also took a look at #371 and I'm wondering: why can't we support both assertion styles? Both addProperty and addMethod return a |
I think it's worth looking into again. Just to make sure we don't duplicate past efforts, here is a quote from @keithamus in the #371 thread that contains a ton of background information related to the original fix to this issue and the reason it got reverted:
|
I just finished reviewing the history on this issue and it doesn't look good for supporting both syntax without introducing breaking changes, at least not with the previous approach of having the getter return a noop. @lucasfcosta, would you mind elaborating on your idea:
|
Well, turns out I was wrong. Unfortunately it's not possible to have both accessors and values for the same property. When trying to run a code which sets both acessors and values I've got this:
So I guess there's nothing we can do about this. EDIT: Hey @meeber, I was thinking about using |
Ahh gotcha. Nice timing btw :D |
Just to clarify the matter: we still get lots of requests regarding this. I think eventually, when we tackle some of the things on the Roadmap - we'll have the flexibility of offering interfaces which don't use properties. But I think it'd be very turbulent to change things right now. For now, linters & IDEs can be tweaked, or you can use I'll close this because of all of the above discussion, which is to say "we're not saying wontfix, just wontfix-right-now". |
Hello!
Thank you for this great library!
I'm using a construct like this:
expect(value).to.not.be.ok()
, however, I'm getting an error causeok
is not a function.When I use it like this:
expect(value).to.not.be.ok
, it works fine, but raises an error in my IDE, cause this construct is not a call and is not assigned to anything, i.e. redundant construct.I think it makes sense to make such constructs at least look like a normal function call like in my firxt example:
expect(value).to.not.be.ok()
.What do you think? Thanks!
The text was updated successfully, but these errors were encountered: