diff --git a/rpt.js b/rpt.js index 5229897..ea2a5da 100644 --- a/rpt.js +++ b/rpt.js @@ -98,7 +98,11 @@ function loadNode (logical, physical, cache, cb) { var realpath function thenReadPackageJson (er, real) { - if (er) return cb(er) + var node + if (er) { + node = new Node(null, logical, physical, er, cache) + return cb(null, node) + } debug('realpath l=%j p=%j real=%j', dpath(logical), dpath(physical), dpath(real)) var pj = path.join(real, 'package.json') realpath = real diff --git a/test/basic.js b/test/basic.js index 0dcb538..8a757f0 100644 --- a/test/basic.js +++ b/test/basic.js @@ -123,6 +123,14 @@ test('missing folder', function (t) { t.end() }) }) +test('missing symlinks', function (t) { + rpt(path.resolve(fixtures, 'badlink'), function (er, d) { + if (er && er.code !== 'ENOENT') throw er + var childError = d.children.length === 1 && d.children[0].error + t.ok(childError, 'Child node has an error') + t.end() + }) +}) function archyize (d, seen) { diff --git a/test/fixtures/badlink/node_modules/foo b/test/fixtures/badlink/node_modules/foo new file mode 120000 index 0000000..1910281 --- /dev/null +++ b/test/fixtures/badlink/node_modules/foo @@ -0,0 +1 @@ +foo \ No newline at end of file