tschaub / mock-fs

Configurable mock for the fs module
https://npmjs.org/package/mock-fs
Other
906 stars 86 forks source link

net.createServer still uses real file system #370

Open TheDirigible opened 1 year ago

TheDirigible commented 1 year ago

When using net.createServer to create a unix domain socket (socket file), it is created in the real file system, even though mock-fs was used. Is there any fix for this?

3cp commented 1 year ago

mock-fs is not an implementation of file system, it only works in nodejs context by monkey patching some methods. Socket file is probably out of reach.

For your use case, you can try to use a real file system like tmpfs to create a transient file system in ram.

3cp commented 1 year ago

Yes, besides normal file and directory, mock-fs only has symlink.