-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Globally override a module that returns a function #56
Comments
Sure you can! Just assign create a function assigned to a variable and then set var deepest = function () {}
deepest['@global'] = true |
Neat. Thanks! |
Seems like we need to add these special cases to the docs and/or a wiki. |
Sure. I think it merits its own section under |
Agreed, currently we don't even have a wiki to speak of :) |
@bendrucker This |
I know that you can set
'@global': true
in the stubs for modules that are objects, but how do you do it for modules that return functions. For example:Deepest returns a function that I need to mock out, but since it is used inside of Deep, I have to use
@global
.If deepest was exporting the inner object instead of the wrapping function, I could do this:
But since deepest returns a function, my understanding is that I have to mock it like this:
But I can no longer set '@global' on the mock object. Right? How should I handle this? This situation has arisen because of the api design of a third party module so I sadly can't really restructure these calls.
The text was updated successfully, but these errors were encountered: