Skip to content

Commit

Permalink
fix: 🐛 show directory path when throwing EISDIR in mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Feb 9, 2019
1 parent f77fa8b commit 9dc7007
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/volume/__snapshots__/mkdirSync.test.ts.snap
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`mkdirSync throws when creating root directory 1`] = `"EISDIR: illegal operation on a directory, mkdir"`;
exports[`mkdirSync throws when creating root directory 1`] = `"EISDIR: illegal operation on a directory, mkdir '/'"`;

exports[`mkdirSync throws when re-creating existing directory 1`] = `"EEXIST: file already exists, mkdir '/new-dir'"`;
2 changes: 1 addition & 1 deletion src/volume.ts
Expand Up @@ -1771,7 +1771,7 @@ export class Volume {

// This will throw if user tries to create root dir `fs.mkdirSync('/')`.
if (!steps.length) {
throwError(EISDIR, 'mkdir');
throwError(EISDIR, 'mkdir', filename);
}

const dir = this.getLinkParentAsDirOrThrow(filename, 'mkdir');
Expand Down

0 comments on commit 9dc7007

Please sign in to comment.