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
Yes. Sinon itself does it here: https://github.com/cjohansen/Sinon.JS/blob/master/lib/sinon.js#L76
If anyone else finds this via Google as I did, the line referred to above is here in the history:
https://github.com/sinonjs/sinon/blob/79100992248c2512fc5cfec0a73e386bc9564ba4/lib/sinon.js#L76
The same check is now in:
https://github.com/sinonjs/sinon/blob/a5c22f21467375ac192d790b651b19a029084b71/lib/sinon/util/core/wrap-method.js#L38
Most helpful comment
If anyone else finds this via Google as I did, the line referred to above is here in the history:
https://github.com/sinonjs/sinon/blob/79100992248c2512fc5cfec0a73e386bc9564ba4/lib/sinon.js#L76
The same check is now in:
https://github.com/sinonjs/sinon/blob/a5c22f21467375ac192d790b651b19a029084b71/lib/sinon/util/core/wrap-method.js#L38