Skip to content

Commit

Permalink
Being smart about ENOENT won't work on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sebn committed Jul 6, 2017
1 parent 117f278 commit 1a15821
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion cli/src/local/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
Expand Down
12 changes: 2 additions & 10 deletions cli/test/unit/local/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 1a15821

Please sign in to comment.