Closed elicwhite closed 9 years ago
Sure you can! Just assign create a function assigned to a variable and then set deepest['@global'] = true
.
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 API
. Wikis don't actually get read. Agreed?
Agreed, currently we don't even have a wiki to speak of :)
@bendrucker This '@global' = true
implementation of yours is truly genius! :+1:
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.