From 1a1582176cccb666ea971cfef49e9c3383aa0a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Nicouleaud?= Date: Thu, 6 Jul 2017 11:36:33 +0200 Subject: [PATCH] Being smart about ENOENT won't work on Windows https://github.com/nodejs/node/issues/8797 --- cli/src/local/index.js | 1 - cli/test/unit/local/index.js | 12 ++---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/cli/src/local/index.js b/cli/src/local/index.js index 5ce156667..6e06099d4 100644 --- a/cli/src/local/index.js +++ b/cli/src/local/index.js @@ -358,7 +358,6 @@ class Local implements Side { this.events.emit('delete-file', doc) return } catch (err) { - if (err.code === 'ENOENT') return if (err.code !== 'ENOTEMPTY') throw err } log.warn({path: doc.path}, 'Folder is not empty!') diff --git a/cli/test/unit/local/index.js b/cli/test/unit/local/index.js index 3ca31d9c5..d39054808 100644 --- a/cli/test/unit/local/index.js +++ b/cli/test/unit/local/index.js @@ -680,19 +680,11 @@ describe('Local', function () { ]) }) - it('does not complain when folder was already deleted (ENOENT)', async function () { + it('does not swallow fs errors', async function () { const doc = builders.dirMetadata().build() await should(this.local.deleteFolderAsync(doc)) - .be.fulfilled() - }) - - it('does not swallow other fs errors', async function () { - const doc = builders.dirMetadata().build() - await fs.ensureFileAsync(fullPath(doc)) - - await should(this.local.deleteFolderAsync(doc)) - .be.rejectedWith(/ENOTDIR/) + .be.rejectedWith(/ENOENT/) }) it('throws when given non-folder metadata', async function () {