-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add an overlay option #142
Comments
that would satisfy my main use case. |
Is this still the direction you want to take it? Any code written yet? This would solve my case quite nicely as well. |
Seconding this! I'm having problems mixing proxyquire and mock-fs, this would solve it! |
I'll need this to keep fileception working with mock-fs 4. Or I'd need the |
Hello, Great tool and would love to use it, but can't. Below code doesn't work if I comment out line 1. There are other examples where a library I use attempts to lazy load its dependencies after file system was mocked for my test. Would greatly appreciate a built-in ability to use mock-fs with such libraries. var set = require ('lodash/set');
var csv = require ('csvtojson')();
var mockfs = require ('mock-fs');
let mockfileO = {};
mockfileO[`${process.cwd()}\\test.csv`] =
'header1,header2\n' +
'data1-1,data2-1\n' +
'data1-2,data2-2\n';
mockfs (mockfileO);
let stream = require ('csvtojson')().fromFile (`${process.cwd()}\\test.csv`)
.on ('error', (err)=>{ throw new Error(err); })
.on ('end', mockfs.restore );
stream.pipe (process.stdout); |
Like many others, I've run into this as a show-stopper, too. Need .fs() or this issue. Full integration tests in particular must have access to the original file system. |
An
overlay
option would make it so thefs
module operates on the in-memory filesystem for all mocked paths and operates on the real file system for all other paths.For example:
The text was updated successfully, but these errors were encountered: