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

Comments

@shellscape
Copy link

commented Dec 14, 2016

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

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2018

Currently you can do this (master branch)

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

This comment has been minimized.

Copy link
Contributor

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!

@stalniy stalniy closed this Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.