Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow fs functions to be called without fs as this arg #11

Closed
wants to merge 1 commit into from

Conversation

tschaub
Copy link

@tschaub tschaub commented Nov 3, 2013

The node fs functions can be called without the fs module as the this argument. This is fairly common practice with things like async:

async.map(paths, fs.stat, function(err, results) {
  ...
});

With this change, the mock stat, mkdir, and readFile functions can be called without the mock itself as the this arg.

The node fs functions can be called without the fs module as the this argument.
This is fairly common practice with things like async:

    async.map(paths, fs.stat, function(err, results) {
      ...
    });
@tschaub
Copy link
Author

tschaub commented Nov 3, 2013

I reordered the methods so the async versions are defined first. I recognize this makes the diff bigger than it has to be. I can rework the commit to minimize the diff if it would make review easier.

@tschaub
Copy link
Author

tschaub commented Feb 18, 2014

In case anybody else runs into this issue, I've created an alternative: mock-fs. This works with Node 0.8, 0.9, 0.10, and 0.11 (as of this writing) on OSX, Linux, and Windows.

@tschaub tschaub closed this Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant