tschaub / mock-fs

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

fs.readdir() doesn't return after requiring mock-fs on node 6.0.0+ #120

Closed krajzeg closed 8 years ago

krajzeg commented 8 years ago

Simply requiring mock-fs causes fs.readdir() to never call its callback. This interferes with using the real filesystem, and mock.restore() doesn't fix the issue. I never even call mock(...) itself.

Tried on 6.2.0, 6.0.0 and 5.0.0 - the example below works properly on 5.0.0, but breaks on the 6.0.0+ versions.

var fs = require('fs');
fs.readdir('.', (err, files) => console.log(err,files)); // works OK
var mockfs = require('mock-fs');
fs.readdir('.', (err, files) => console.log(err,files)); // never called on 6.0.0+
mockfs.restore();
fs.readdir('.', (err, files) => console.log(err,files)); // never called on 6.0.0+

This is on Mac OS X - not sure if it happens elsewhere.

tschaub commented 8 years ago

The example above generates the output I expect with mock-fs@3.10.0. Please reopen if you upgrade to the latest version and are still seeing issues.

m-mcgowan commented 8 years ago

👍 works for me! Thanks!