-
Notifications
You must be signed in to change notification settings - Fork 86
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
Only override process.binding('fs') #182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this looks like a very nice simplification if it works.
It's probably worth noting that process.binding('fs')
isn't officially a stable Node feature; it's possible that the binding will unexpectedly change in the future, or do something different between major Node versions. But it looks like you already have a lib/binding.js
file, so I suppose that problem isn't newly introduced by this change.
I am using Node 6.3 and Babel to transpile But this PR works for me, great job @tschaub ! Any plans to release it? |
@not-an-aardvark - Yeah, I'm aware that @eugef - I haven't had time to address the breaking changes mentioned above. I'm personally most interested in fixing the I'll release a beta and see if we can get some feedback. |
When it would be released? |
You can install |
This reworks how the
fs
module is mocked. Instead of overriding methods on the module itself, only theprocess.binding('fs')
methods are replaced.Possible breaking changes:
mock.fs()
function has been removed (this could be added back)fs.Stats
is no longer aninstanceof fs.Stats
(this could be possible to support again)require()
calls don't work consistently (perhaps this can be made to work again too)