Closed tschaub closed 7 years ago
I am using Node 6.3 and Babel to transpile import
statements.
The current master doesn't work for me.
But this PR works for me, great job @tschaub !
Any plans to release it?
@not-an-aardvark - Yeah, I'm aware that process.binding('fs')
is not a stable feature. It turns out that the mock-fs
binding works with Node 0.8 through 7. So although there have been Node releases with breaking fs
changes, I've been able to maintain a single binding that has worked with them all.
@eugef - I haven't had time to address the breaking changes mentioned above. I'm personally most interested in fixing the require
issue (making require
consistently work with the real fs
even when called lazily). Not sure which of these will affect the most users.
I'll release a beta and see if we can get some feedback.
When it would be released?
You can install mock-fs@beta
to try it out.
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)