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

Implement spies for get/set functions on accessor properties #1008

Closed
wants to merge 5 commits into from

Conversation

smacker
Copy link
Contributor

@smacker smacker commented Dec 30, 2015

I tried to implement #943

Added spyOnProperty method as @slackersoft recommended.

@brunoskonrad
Copy link

❤️

@smacker
Copy link
Contributor Author

smacker commented Feb 24, 2016

Please, take a look.
I updated code to fix merge conflict with #1036
And added same test for spyOnProperty.

Needed adding to the env and require interface
@henrahmagix
Copy link
Contributor

@smacker I have fixed your PR so spyOnProperty is available in specs: see smacker#1 Merging that should update this PR so hopefully we can get this merged, I really want to use this feature =)

Make spyOnProperty available in tests
@smacker
Copy link
Contributor Author

smacker commented May 16, 2016

Thanks a lot! Merged!

@celluj34
Copy link

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?

@henrahmagix
Copy link
Contributor

@celluj34 My pull-request into this was merged.

I agree, hearing a release timeline would be really nice!

@gantaa
Copy link

gantaa commented Aug 11, 2016

Release this feature please. Thanks for the hard work

@erwinverdonk
Copy link

erwinverdonk commented Sep 7, 2016

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 :).

@henrahmagix
Copy link
Contributor

@erwinverdonk When smacker#2 is merged the conflicts here should be fixed =)

Spy on property: merge jasmine/jasmine master
@smacker
Copy link
Contributor Author

smacker commented Sep 13, 2016

I merged it, but looks like jasmine team isn't interested in this feature. :(

@erwinverdonk
Copy link

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.

@erwinverdonk
Copy link

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)
This new PR is also merged in the old PR here: #1008 (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

@maxlk
Copy link

maxlk commented Sep 22, 2016

At first, I thought that it's a great feature, but now I think that it's not usable.
The first reason, it's too verbose:

expect(Object.getOwnPropertyDescriptor(subject, 'spiedProperty').set).toHaveBeenCalled()

The second and the main reason, it's definitely a bad practice to mark property configurable just for testing purpose. If design doesn't require the property to be configurable, it should not be. And it's very serious obstacle, that makes this feature almost useless.

slackersoft pushed a commit that referenced this pull request Nov 4, 2016
…into celluj34-spyOnProperty2

- Merges #1203 from @celluj34
- Merges #1008 from @smacker
- Fixes #943
@slackersoft slackersoft closed this Nov 4, 2016
@rbnzdave
Copy link

rbnzdave commented Dec 14, 2016

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.

@henrahmagix
Copy link
Contributor

Thanks @slackersoft!

@booleanbetrayal
Copy link

I just used this today and it was glorious. =]

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

Successfully merging this pull request may close these issues.

None yet

10 participants