Closed elicwhite closed 9 years ago
And this is the test I have for it: https://github.com/TheSavior/rewire-global/blob/master/test/tests/tests.js#L51
Thanks for the heads up and sharing your code. This is something I'd considered and forgotten about, I think it's certainly worth adding.
It's causing one of our tests to fail right now and I'm uncomfortable manually adding get and set to our assertion. What do you believe should be the next steps? I'd be happy to try to put out a PR making rewireify use Object.defineProperty just like rewire-global. Do you agree with that approach?
Very happy to accept a PR as my connection is super-flakey over 3G right now!
Currently with rewireify,
__get__
and__set__
are part of the returned array when using Object.keys on a module that returns an object.For example:
However, I don't want my code to see anything about
__get__
or__set__
, such that my assert would be:I ran into this problem when building a port of rewireify for node, and used Object.defineProperty to fix it: https://github.com/TheSavior/rewire-global/blob/master/index.js