Skip to content
Merged
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
4 changes: 2 additions & 2 deletions workspaces/arborist/lib/dep-valid.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ const depValid = (child, requested, requestor) => {
const linkValid = (child, requested, requestor) => {
const isLink = !!child.isLink
// if we're installing links and the node is a link, then it's invalid because we want
// a real node to be there
if (requestor.installLinks) {
// a real node to be there. Except for workspaces. They are always links.
if (requestor.installLinks && !child.isWorkspace) {
return !isLink
}

Expand Down
15 changes: 14 additions & 1 deletion workspaces/arborist/test/dep-valid.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,21 @@ t.test('invalid request all together', t => {

t.test('installLinks makes Link nodes invalid', t => {
const requestor = { errors: [], installLinks: true, edgesOut: new Map() }
const child = { isLink: true, name: 'kid' }
const child = { isLink: true, isWorkspace: false, name: 'kid' }
const request = { type: 'directory' }
t.notOk(depValid(child, request, null, requestor))
t.end()
})

t.test('installLinks does not make workspace nodes invalid', t => {
const requestor = { errors: [], installLinks: true, edgesOut: new Map() }
const child = {
isLink: true,
isWorkspace: true,
name: 'kid',
realpath: '/some/path',
}
const request = normalizePaths(npa('file:/some/path'))
t.ok(depValid(child, request, null, requestor))
t.end()
})