Skip to content

Commit

Permalink
fix: don't mark workspaces as invalid if installing links (#5484)
Browse files Browse the repository at this point in the history
Workspaces are always links, even if we are installing links
  • Loading branch information
wraithgar authored Sep 8, 2022
1 parent 7fc2b6f commit fe926ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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()
})

0 comments on commit fe926ed

Please sign in to comment.