tschaub / mock-fs

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

Mocking multiple FS for testing EXDEV #206

Open dandanknight opened 7 years ago

dandanknight commented 7 years ago

Hi, apologies for asking in the issues, but I've had no luck elsewhere.

I have a function that moves a file from a -> b using node's fs.rename(). If a or b are on a different device (such as an NFS mount) then my code picks up the EXDEV error, and performs a copy and deletes the source file instead.

I'm looking to use mock-fs to mock the filesystem for testing purposes, and I'm wondering if anybody here knows how I can simulate an EXDEV error using it?

For instance, can I create 2 mock filesystems, and attempt a move between them to achieve this?

Many thanks