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

Avoid non-function chai matchers #70

Closed
jurko-gospodnetic opened this issue Sep 14, 2015 · 1 comment
Closed

Avoid non-function chai matchers #70

jurko-gospodnetic opened this issue Sep 14, 2015 · 1 comment

Comments

@jurko-gospodnetic
Copy link

I encountered an issue recently with sinon-chai caused by the design choice to make some of its chai matchers implemented as non--function properties.

If you perform an expectation like:

expect(spy).to.have.been.calledOnce;

that expectation will not fail if the test code fails to configure chai to support sinon-chain matchers, and will instead simply be quietly ignored.

On the other hand, if sinon-chai implemented such matchers using a function call syntax, as in:

expect(spy).to.have.been.calledOnce();

then forgetting to do chai.use(require('sinon-chai')) would not cause tests to be quietly ignored and would instead cause them to report an error complaining about undefined not being a callable.

@domenic
Copy link
Collaborator

domenic commented Sep 14, 2015

I prefer the shorter syntax.

@domenic domenic closed this as completed Sep 14, 2015
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