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

rmdirSync doesn't throw on non-empty directory #61

Open
DanielSWolf opened this issue Aug 7, 2018 · 0 comments
Open

rmdirSync doesn't throw on non-empty directory #61

DanielSWolf opened this issue Aug 7, 2018 · 0 comments

Comments

@DanielSWolf
Copy link

The original Node implementation of rmdirSync throws an error if the directory is not empty. The implementation in memory-fs quietly deletes the directory an all its contents. rmdirSync effectively behaves like rmdirpSync should.

This is a problem when using memory-fs to mock the native file system and trusting that it behaves similarly.

const MemoryFileSystem = require('memory-fs');

const fs = new MemoryFileSystem();
fs.mkdirpSync('/a/b/c');
fs.rmdirSync('/a/b'); // This should fail. b is not empty.
console.log(fs.readdirSync('/a')); // Empty
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 a pull request may close this issue.

1 participant