- Correctly follow a symlink chain in
binding.open()
(thanks @vlindhol, see #195)
In earlier versions of mock-fs
, a monkey-patched version of the fs
module was used to provide an in-memory filesystem. With each major release of Node, the mock-fs
package needed to include a modified copy of the fs
module. With the mock-fs@4
release, this package no longer includes a modified copy of the fs
module. Instead, this package overrides process.binding('fs')
. While this is not part of Node's stable API, it has proven to be a more stable interface than the fs
module itself (based on experience implementing it with Node 0.8 through 7.0).
Upgrading from 3.x to 4.0 should be straightforward for most applications. There are several breaking changes that may be restored in future releases:
- The
mock.fs()
function has been removed. - The object created by
fs.stat()
and friends is no longer an instance offs.Stats
(though it behaves as one). - Lazy
require()
calls do not work consistently.
Detailed changes:
- Only override
process.binding('fs')
(#182) - Expose the root of the mocked filesystem (thanks @ciaranj, see #194)
- Revert the require cache clearing behavior (#181).
- Support for Node 7.x (thanks @goliney, see #174).
- Remove calls to
printDeprecation
(#175). - Break early when checking version (thanks @isiahmeadows, see #157).
- Add a note about restoring
fs
(thanks @matheuss, see #147). - Clear the require cache before overriding fs functions (#141)
- Support for Node 6.x (thanks @tmcw, see #107).
- Implement
binding.writeBuffers()
(see #94).
- Add
createCwd
andcreateTmp
options to control the creation ofprocess.cwd()
andos.tmpdir()
directories in the mocked filesystem (see #72). - Update Travis and AppVeyor configurations (see #73)
- Remove unused dev dependency (see #75)
- Support for Node 5.x (thanks @tmcw, see #69).
- Support for Node 4.x (thanks @AlexMeah, see #65).
- Traverse symlinks recursively (thanks @caitp, see #57).
- Upgrade to rewire@2.3.4 (thanks @mbarlock, see #60).
- Support for io.js 3.0 (thanks @JustBlackBird, see #61).
- Follow symlinks in
readdir()
andreaddirSync()
(thanks @caitp, see #56).
- Override
process.cwd()
andprocess.chdir()
to work with mocked filesystem (thanks @timkendrick, see #41). - Add note about known incompatibilities (thanks @psalaets, see #45).
- Support for io.js 2.0 (thanks @jwilsson, see #38).
- Add
birthtime
toStats
objects (thanks @meandmycode, see #33).
- Support for io.js 1.1 (thanks @andrewblond, see #21).
- Testing on Windows with AppVeyor (thanks @andrewblond, see #22).
- Support for Node 0.12 (thanks @mlegenhausen, see #18).
- Preserve arity of callbacks (see #11).
- Fixes for Node 0.11.13 (see #9).
- Respect file mode on POSIX-compliant systems (see #7).
- Add benchmarks comparing mock-fs and fs modules (see #6).
- Added more complete license text.
- Test on Node 0.9 and 0.11 in addition to 0.8 and 0.10.
- Added this changelog.
- Removed unused gruntfile.js.
- Directory mtime is now updated when items are added, removed, or modified (#2).
- Fixed several issues on Windows (see #3). One issue remains on Windows with Node 0.8 (see #4).
- Swapped out Grunt with a single script to run tasks (see #5).
- Simplified API (see #1).