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

chai.spy.on(...).returns #62

Closed
shellscape opened this issue Dec 14, 2016 · 2 comments
Closed

chai.spy.on(...).returns #62

shellscape opened this issue Dec 14, 2016 · 2 comments

Comments

@shellscape
Copy link

I mentioned in a comment on #39 that I'm migrating a large project from jasmine 1.x to mocha. I really want to avoid using sinon-chai and would much rather roll with pure chai goodness. Jasmine however, has a magical little call that's prolific in our test codebase:

spyOn(object, 'method').andReturn(someValue);

Best I can tell, that's altogether missing from this lib. If there's a method I've missed, or there's a way to achieve the same, please do share it. I dare say it's not spelled out very clearly anywhere. But then I might be a big dummy.

Anyhow, this would be a grand feature to have.

@stalniy
Copy link
Contributor

stalniy commented Jan 10, 2018

Currently you can do this (master branch)

spy.on(obj, "method", returns => 5)

@stalniy
Copy link
Contributor

stalniy commented Jan 10, 2018

In the nearest time 1.0.0 will be pushed with support for declarations like above + documentation. Thanks for using chai-spies!

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