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

Add options for creating cwd and tmp directories #72

Merged
merged 4 commits into from
Dec 20, 2015
Merged

Add options for creating cwd and tmp directories #72

merged 4 commits into from
Dec 20, 2015

Conversation

tschaub
Copy link
Owner

@tschaub tschaub commented Dec 20, 2015

By default, process.cwd() and os.tmpdir() are created for new mock filesystems. To change this behavior, createCwd and createTmp options can be passed.

E.g.

// mock the filesystem without creating process.cwd()
mock({'/one': 'file contents'}, {createCwd: false});
// mock the filesystem without creating os.tmpdir()
mock({file: 'contents'}, {createTmp: false});

Fixes #71.

@gustavnikolaj
Copy link

I tested this change with a branch on my project, and it works after adding the options argument to this function https://github.com/tschaub/mock-fs/blob/options/lib/index.js#L109 and passing it through to FileSystem.create. :-)

@tschaub
Copy link
Owner Author

tschaub commented Dec 20, 2015

it works after adding the options argument to this function

Yikes. Apologies for making it awkward to test. I meant to expose the options to these functions. fd9ab8a makes this actually useful.

tschaub added a commit that referenced this pull request Dec 20, 2015
Add options for creating cwd and tmp directories.
@tschaub tschaub merged commit ad183ca into master Dec 20, 2015
@tschaub tschaub deleted the options branch December 20, 2015 16:06
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.

2 participants