From ae17feedb12e66c2cc64c17cde421d0d27cd9e19 Mon Sep 17 00:00:00 2001 From: David Kudera Date: Sat, 20 Jun 2015 16:31:25 +0200 Subject: [PATCH] do not throw an exception when calling lstat on non-symbolic files [closes #14] --- src/fs.js | 4 ---- test/fs.posix.js | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/fs.js b/src/fs.js index 0441467..7ac0c71 100644 --- a/src/fs.js +++ b/src/fs.js @@ -700,10 +700,6 @@ stats = this._data[path].stats; - if (!stats.isSymbolicLink()) { - Errors.notSymlink(path); - } - return stats; }; diff --git a/test/fs.posix.js b/test/fs.posix.js index 097b13f..3f320af 100644 --- a/test/fs.posix.js +++ b/test/fs.posix.js @@ -395,11 +395,10 @@ }); }); - it('should return an error if path is not a symlink', function (done) { + it('should return for regular file', function (done) { fs.mkdirSync('/var/www'); - fs.lstat('/var/www', function (err) { - expect(err).to.be.an.instanceof(Error); - expect(err.message).to.be.equal("Path '/var/www' is not a symbolic link."); + fs.lstat('/var/www', function (err, stats) { + expect(stats.isDirectory()).to.be.true; done(); }); });