diff --git a/lib/fileUtils.js b/lib/fileUtils.js index 63c80027..2f551ff9 100644 --- a/lib/fileUtils.js +++ b/lib/fileUtils.js @@ -10,8 +10,14 @@ module.exports = function(fs) { function statFile(filePath) { return new Promise(function(resolve, reject) { fs.stat(filePath, function(err, stat) { - // No rejection here as it is ok if the file was not found - resolve(stat ? {path: filePath, stat: stat} : null); + if (err) { + if (err.code === "ENOENT") { // "File or directory does not exist" + return resolve(null); + } else { + return reject(err); + } + } + resolve({path: filePath, stat}); }); }); } @@ -57,7 +63,7 @@ module.exports = function(fs) { content: content, path: fileInfo.path, localPath: lessInputPath, - stats: fileInfo.stats + stat: fileInfo.stat }); } });