-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Implement spies for get/set functions on accessor properties #1008
Conversation
❤️ |
0a8c604
to
2ddf418
Compare
Please, take a look. |
Needed adding to the env and require interface
Make spyOnProperty available in tests
Thanks a lot! Merged! |
It looks like this has been merged, but the PR is still open. Also, I could really use this functionality. Any word on when it would be available in nuget/npm? |
@celluj34 My pull-request into this was merged. I agree, hearing a release timeline would be really nice! |
Release this feature please. Thanks for the hard work |
I am just passing by this issue and notice that you are already waiting months for this to be released. However as you can see at the bottom of this page (in desktop view) the PR branch has conflicts that needs resolving. I take that this is the reason why it is not merged yet, although not well communicated. So maybe it is an idea that either the PR author or someone else creates a new branch from master, applies changes again, resolve any conflicts, and do another PR for this new branch? Maybe then it gives the maintainers more motivation to actually merge it, as it should then be conflict free :). |
Conflicts: spec/core/SpyRegistrySpec.js
@erwinverdonk When smacker#2 is merged the conflicts here should be fixed =) |
Spy on property: merge jasmine/jasmine master
I merged it, but looks like jasmine team isn't interested in this feature. :( |
Excellent work guys! Lets at least try to get a response from the Jasmin team. I will try to reach out to the maintainers for this. |
Ok, I just sent this email to the maintainers (amavisca, jboyens and vinsonchuong): Dear maintainers of Jasmine, To be short about this; this Pull Request was very old and had not received any feedback. Because of the time that had passed there were conflicts introduced that needed fixing before it could be pulled in. The community made the effort to branch off the latest code base, apply the changes for the PR again and add it as a new PR. It can be found here: #1203 (comment) The only question now is what is your feedback for this Pull Request? Maybe we need to change something or you need to discuss this internally. Would you please have a look? Please let us know :). Kind Regards, Erwin Verdonk |
At first, I thought that it's a great feature, but now I think that it's not usable. expect(Object.getOwnPropertyDescriptor(subject, 'spiedProperty').set).toHaveBeenCalled() The second and the main reason, it's definitely a bad practice to mark property |
For a start, where does verbose come into it, they were asking for a spyOnProperty([my object path],[the property]) so would have used a variable name, and then there is the fact that you wouldnt add this to your existing codebase just for testing purposes, you would use it to check if fields in your mock services/objects were accessed by the object you are testing, which is the exact reason I'm trying to use it. |
Thanks @slackersoft! |
I just used this today and it was glorious. =] |
I tried to implement #943
Added spyOnProperty method as @slackersoft recommended.