tschaub / mock-fs

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

not working on node 10.5 #238

Closed twawszczak closed 5 years ago

twawszczak commented 6 years ago

after fs module refactors and changes

demosdemon commented 6 years ago

ahh, this is my problem!

from node https://github.com/nodejs/node/blob/ebf5b58bec6954ebeed1c302cf31ff55494a0c93/lib/fs.js#L238-L252

from mock-fs https://github.com/tschaub/mock-fs/blob/5b165be6b7280b7c9ddaab9adac89a6236d123d0/lib/binding.js#L357-L380

jimthedev commented 6 years ago

If anyone has any good ideas on how to solve this I'd be willing to put in a PR.

tomhughes commented 6 years ago

I've opened #240 which fixes the issues with stat/fstat/lstat but there is a second set of problems with createReadStream and createWriteStream which I have not been able to find a fix for so far.

Basically the problem is that after restoring the mocked fs and then starting a new one writing to a stream created against the new mock fs will wind up calling back into writeBuffers with an fd from the new context but with this bound to the old context which leads the fd not being found. I have so far been unable to determine exactly why however...

tschaub commented 6 years ago

Stat calls now work (thanks @tomhughes). I need to do more debugging to figure out how to handle the read after open.

3cp commented 6 years ago

Any progress?

mistic commented 6 years ago

@tschaub @tomhughes any news on solving the streams bug in Node v10.5+? This just become urgent for my current use case

tschaub commented 5 years ago

This should be addressed on the 4.8.0 release (thanks @huochunpeng, see #260).