Skip to content

Simplify the API (breaking changes) - #1

Merged
tschaub merged 4 commits into
masterfrom
two
Jan 11, 2014
Merged

Simplify the API (breaking changes)#1
tschaub merged 4 commits into
masterfrom
two

Conversation

@tschaub

@tschaub tschaub commented Jan 11, 2014

Copy link
Copy Markdown
Owner

The API can be simplified to the following:

  • mock(config) - Back the real fs module with a mock file system.
  • mock.restore() - Restore the fs module so it is backed by the real file system.
  • mock.file(properties) - Create mock files with additional properties.
  • mock.directory(properties) - Create mock directories with additional properties.
  • mock.symlink(properties) - Create mock symlinks with additional properties.
  • mock.fs(config) - Return a fs-like set of functions backed by a mock file system (without modifying the real fs module).

This removes the mock.init method and gets rid of the restore return from mock.

To set up a mock file system, call mock().  To restore the original file system, call mock.restore().  To create a mock fs module while leaving the original unmodified, call mock.fs().
tschaub added a commit that referenced this pull request Jan 11, 2014
Simplify the API (breaking changes for 2.0).
@tschaub
tschaub merged commit 5af9320 into master Jan 11, 2014
@tschaub
tschaub deleted the two branch January 11, 2014 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant