We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Volume
For my unit tests, I'd like to create a virtual file system with a single file and also the directory node_modules/. My program has a dependency that:
node_modules/
With mock-fs, I use mock.load():
mock-fs
mock.load()
mock({ 'foo.txt': 'bar', 'node_modules/': mock.load('node_modules/'), });
I'd like to switch to memfs (with fs-monkey), but I can't add the node_modules/ directory to the virtual file system.
memfs
fs-monkey
I suggest adding the Volume.fromDirectory() function to create a volume from a real directory:
Volume.fromDirectory()
import { Volume } from 'memfs'; import { Union } from 'unionfs'; import { patchFs } from 'fs-monkey'; patchFs(new Union() .use(Volume.fromJSON({ 'foo.txt': 'bar' })) .use(Volume.fromDirectory('node_modules/')));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
For my unit tests, I'd like to create a virtual file system with a single file and also the directory
node_modules/
. My program has a dependency that:node_modules/
directory (e.g. configuration files).With
mock-fs
, I usemock.load()
:I'd like to switch to
memfs
(withfs-monkey
), but I can't add thenode_modules/
directory to the virtual file system.I suggest adding the
Volume.fromDirectory()
function to create a volume from a real directory:The text was updated successfully, but these errors were encountered: