Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Fixes error handling to create a Node Object when a child package is not exist #6

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/badlink/node_modules/foo

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.