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
Sandbox stubbing static function property throws error #1445
Comments
Seems like we have a regression. Could it be related to the new getter/setter stubbing functionality, @lucasfcosta? |
It looks to me that this was introduced with this commit 278c2ce#diff-048fb1194de4b43f7f7e45758f900749R21, changing that check to: var isStubbingNonFuncProperty = (typeof object === "object" || typeof object === "function")
&& typeof property !== "undefined"
&& (typeof actualDescriptor === "undefined"
|| typeof actualDescriptor.value !== "function")
&& typeof descriptor === "undefined"; seems to make it work. Thanks, |
@fatso83, yup! Good catch @raulmatei. I missed a check to see if the passed object itself was a function. That should indeed solve the problem. I'll be more than happy to review a PR from you if you'd like to sendo one. Thanks for the help 😄 |
@lucasfcosta will come with a PR later this week. Hope it won't be too late for others. Raul. |
Hi folks. I can't close issues but I believe this one is done. |
What did you expect to happen?
Should be able to stub a function static property. It worked with v2.2.0
What actually happens
Throws an error:
TypeError: Attempted to wrap object property content as function
How to reproduce
The text was updated successfully, but these errors were encountered: