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

question: how to tell if a function has been spied/stubbed upon? (plugin development) #532

Closed
boneskull opened this issue Aug 3, 2014 · 2 comments

Comments

@boneskull
Copy link

Hi,

Working on angular-debaser, I have a situation in which I want to know if a function is a Sinon.JS stub. Currently I am checking for foo.displayName === 'stub' or foo.displayName === 'spy' but this might be flimsy, and was wondering if there was a canonical way to do it.

thanks,
Chris

@mantoni
Copy link
Member

mantoni commented Aug 3, 2014

Yes. Sinon itself does it here: https://github.com/cjohansen/Sinon.JS/blob/master/lib/sinon.js#L76

@mantoni mantoni closed this as completed Aug 3, 2014
@neocolmartin
Copy link

If anyone else finds this via Google as I did, the line referred to above is here in the history:

} else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {

The same check is now in:

} else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {

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

3 participants