Skip to content

Commit fe926ed

Browse files
authored
fix: don't mark workspaces as invalid if installing links (#5484)
Workspaces are always links, even if we are installing links
1 parent 7fc2b6f commit fe926ed

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

workspaces/arborist/lib/dep-valid.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ const depValid = (child, requested, requestor) => {
109109
const linkValid = (child, requested, requestor) => {
110110
const isLink = !!child.isLink
111111
// if we're installing links and the node is a link, then it's invalid because we want
112-
// a real node to be there
113-
if (requestor.installLinks) {
112+
// a real node to be there. Except for workspaces. They are always links.
113+
if (requestor.installLinks && !child.isWorkspace) {
114114
return !isLink
115115
}
116116

workspaces/arborist/test/dep-valid.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,21 @@ t.test('invalid request all together', t => {
184184

185185
t.test('installLinks makes Link nodes invalid', t => {
186186
const requestor = { errors: [], installLinks: true, edgesOut: new Map() }
187-
const child = { isLink: true, name: 'kid' }
187+
const child = { isLink: true, isWorkspace: false, name: 'kid' }
188188
const request = { type: 'directory' }
189189
t.notOk(depValid(child, request, null, requestor))
190190
t.end()
191191
})
192+
193+
t.test('installLinks does not make workspace nodes invalid', t => {
194+
const requestor = { errors: [], installLinks: true, edgesOut: new Map() }
195+
const child = {
196+
isLink: true,
197+
isWorkspace: true,
198+
name: 'kid',
199+
realpath: '/some/path',
200+
}
201+
const request = normalizePaths(npa('file:/some/path'))
202+
t.ok(depValid(child, request, null, requestor))
203+
t.end()
204+
})

0 commit comments

Comments
 (0)