fs-jetpack
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -0,1 +1,5 @@ | ||
0.6.5 (2015-06-19) | ||
------------------- | ||
* `exists()` can handle ENOTDIR error. | ||
0.6.3 and 0.6.4 (2015-04-18) | ||
@@ -2,0 +6,0 @@ ------------------- |
@@ -23,3 +23,3 @@ "use strict"; | ||
} catch (err) { | ||
if (err.code !== 'ENOENT') { | ||
if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') { | ||
throw err; | ||
@@ -41,3 +41,3 @@ } | ||
if (err) { | ||
if (err.code === 'ENOENT') { | ||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { | ||
deferred.resolve(false); | ||
@@ -44,0 +44,0 @@ } else { |
{ | ||
"name": "fs-jetpack", | ||
"description": "Better file system API", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"author": "Jakub Szwacz <jakub@szwacz.com>", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -1,2 +0,2 @@ | ||
fs-jetpack [![Build Status](https://travis-ci.org/szwacz/fs-jetpack.svg?branch=master)](https://travis-ci.org/szwacz/fs-jetpack) | ||
fs-jetpack [![Build Status](https://travis-ci.org/szwacz/fs-jetpack.svg?branch=master)](https://travis-ci.org/szwacz/fs-jetpack) [![Build status](https://ci.appveyor.com/api/projects/status/er206e91fpuuqf58?svg=true)](https://ci.appveyor.com/project/szwacz/fs-jetpack) | ||
========== | ||
@@ -3,0 +3,0 @@ |
@@ -73,2 +73,26 @@ "use strict"; | ||
describe("edge cases", function () { | ||
it("ENOTDIR error changes into 'false'", function (done) { | ||
// We have here malformed path: /some/dir/file.txt/some_dir | ||
// (so file is in the middle of path, not at the end). | ||
// This leads to ENOTDIR error, but technically speaking this | ||
// path doesn't exist so let's just return false. | ||
fse.outputFileSync('text.txt', 'abc'); | ||
// SYNC | ||
var exists = jetpack.exists('text.txt/something'); | ||
expect(exists).toBe(false); | ||
// ASYNC | ||
jetpack.existsAsync('text.txt/something') | ||
.then(function (exists) { | ||
expect(exists).toBe(false); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
190567
4775