diff --git a/src/__tests__/volume/__snapshots__/mkdirSync.test.ts.snap b/src/__tests__/volume/__snapshots__/mkdirSync.test.ts.snap index 976964a4..d91328f6 100644 --- a/src/__tests__/volume/__snapshots__/mkdirSync.test.ts.snap +++ b/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`] = `"EEXIST: file already exists, mkdir '/'"`; exports[`mkdirSync throws when re-creating existing directory 1`] = `"EEXIST: file already exists, mkdir '/new-dir'"`; diff --git a/src/volume.ts b/src/volume.ts index 73552fd7..8849d71c 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -1812,7 +1812,7 @@ export class Volume { // This will throw if user tries to create root dir `fs.mkdirSync('/')`. if (!steps.length) { - throw createError(EISDIR, 'mkdir', filename); + throw createError(EEXIST, 'mkdir', filename); } const dir = this.getLinkParentAsDirOrThrow(filename, 'mkdir');