Skip to content
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

Throw for non existent properties or language chains #557

Closed
windkomo opened this issue Nov 24, 2015 · 1 comment
Closed

Throw for non existent properties or language chains #557

windkomo opened this issue Nov 24, 2015 · 1 comment

Comments

@windkomo
Copy link

Hello,

I've been using assertions of this type :

expect(assertion).to.be.ko;

Until I discovered that ko didn't exist, so I changed my assertions to this :

expect(assertion).not.to.be.ok;

My issue here is that my ko assertion didn't make my test fail and I believed up until now that I was actually checking for a falsey value. Granted, I assumed that koexisted without looking at the documentation and should have not.

Any opinion on this ?

@keithamus
Copy link
Member

Hi @windkomo, thanks for the issue.

We've discussed this quite a bit, most recently in #549. I'll quote the relevant information from that isssue:

If you want the history you can see #41, #297, #302, #306, #321, #326 and probably some others I've missed.

For ways we're actually planning to solve this problem, please have a look at our Roadmap in #457, and more specifically #407 - where we discuss adding proxies which would let us throw errors on undefined properties.

If you need a fix right now, then you have two options:

  1. Don't use the property getters, instead use method alternatives, e.g. expect(true).to.equal(false);
    Use dirty-chai which rewrites all of those property assertions to method assertions, so expect(true).to.be.false becomes expect(true).to.be.false().
  2. We'd love to get some help on making Use ES6 Proxy to throw on non-existing assertions #407 a reality, so if you'd like to continue the discussion there, or perhaps make a pull request, that'd be awesome 😄

I'm closing this, given that it's a duplicate of all of the above mentioned issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants