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.returns #39

Closed
startswithaj opened this issue Nov 2, 2015 · 18 comments
Closed

chai.spy.returns #39

startswithaj opened this issue Nov 2, 2015 · 18 comments

Comments

@startswithaj
Copy link

Not a big deal but http://chaijs.com/plugins/chai-spies shows the readme on the master branch which includes the new chai.spy.return feature. This feature thats on master hasn't been tagged and released yet. So if you follow the instructions npm install chai-spies. The api for chai.spy.returns is missing.

You come to the gh repo and master has spy.returns. Should this be tagged and released?

@SoAG
Copy link

SoAG commented Nov 6, 2015

Any news on this? Would love to use this functionality.

@keithamus
Copy link
Member

Sorry for the delay. I was considering cutting a release as a major version - but I think I might want to drop chai.spy().reset() and 1.0 onwards keeping everything out of the spy prototype. I'll work a bit on it in a few hours.

@bhough
Copy link

bhough commented Dec 1, 2015

Any updates on this?

@trainerbill
Copy link

Update? I need this to return true to a confirm dialog...

@Shridhad
Copy link

Any updates on this? We do need this feature and we can not access development/master version directly. May we know when will be the next version released?

@stalniy
Copy link
Contributor

stalniy commented Dec 9, 2016

@keithamus is it possible to make me contributor and provide all relevant rights? So, then I will work on new sandbox feature and rest stuff which we discussed about year ago?

@keithamus
Copy link
Member

@stalniy happy to make you a maintainer, but either way you are free to make PRs against the code to work on features. Our maintainers do not code directly into master, the only benefit of being maintainer is you can close issues and approve other user's PRs. Do you want me to make you a maintainer?

@stalniy
Copy link
Contributor

stalniy commented Dec 10, 2016

@keithamus sure, thanks! I just want to move stuff a bit forward and make chai spies more popular as it's really a shiny lib with the easiest/shortest implementation and powerful features

@shellscape
Copy link

@keithamus @stalniy what's the recommended way to obtain this feature? I'm trying to move a large project from jasmine to mocha and the .returns functionality is key. Is there a tagged version of the module, or should I require on the repo itself?

@stalniy
Copy link
Contributor

stalniy commented Dec 15, 2016

We have few ideas of how to implement this in #38 but haven't agreed on the interface, because want leave all spies to be immutable.

There is a PR for Sanboxes feature which I plan to finish this weekend and then get back to spy.on

In case if you use Angular it shouldn't affect you because angular allows to recreate services before each test. So, you can do service.method = spy.returns(5).

As another temporary workaround you can do the same way or create a wrapper function to properly track and restore spies.

@almirfilho
Copy link

Any updates on this?

@shellscape
Copy link

@stalniy @keithamus hey fellas, blocking the release of returns on several other issues that don't have any traction is brutal. We don't use angular, as as I laid out in #62, we're trying not to mix components for spies.

is there any possibility we can at least get an @beta tagged version of this module so we can start using that method? I am loathe to publish a derivative module of this from a fork, but we're in great need.

@keithamus
Copy link
Member

@shellscape For the existing returns feature you can simply monkey patch with a one-liner, it is just chai.spy.returns = (v) => chai.spy(() => v). Any other returns proposals such as #62 are an area of contention right now - I think it's important we retain immutability in spies to simplify testing.

@shellscape
Copy link

@keithamus thanks for getting back to me on that. still bummed that the code in master is still blocked, but appreciative and hope you guys are able to move forward.

@keithamus
Copy link
Member

@shellscape to be honest me too, I'd like to use some of the features already in master, but I want to make sure we get the API right in a way that means we don't just ape other libs, and keep things clean and simple. FWIW you could, if you wanted you could always install chai from a specific commit ref, for example npm i chaijs/chai-spies#58f50ec3 will install a version of chai-spies based on 58f50ec which including chai.spy.returns()

@stalniy
Copy link
Contributor

stalniy commented Jan 10, 2018

@keithamus I think it's time to release! I plan to fix greenkeaper issues and let's publish 1.0.0. The rest of the features will be added in subsequent releases. Are you ok with that?

@keithamus
Copy link
Member

I'm happy to make a release if you are @stalniy. I've been too busy to make any progress with chai spies, so a release in the meantime would be excellent - if you can make the time 😄. If you raise a PR which changes the package.json and does the make build step, then I can merge and we can work on publishing a Release on the github releases page which will trigger a 1.0 release.

@stalniy
Copy link
Contributor

stalniy commented Jan 10, 2018

@keithamus everything is ready and waiting review. Closed some PRs and issues to cleanup stuff a bit.
So, could you please proceed? :)

Also I think it's time to close this issue as well. As chai.spy.returns will be available in 1.0.0.

@stalniy stalniy closed this as completed Jan 10, 2018
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

9 participants