Skip to content

Commit 3d96494

Browse files
nlflukekarrys
authored andcommitted
fix(arborist): when replacing a Link with a Node, make sure to remove the Link target from the root
1 parent 4ca858c commit 3d96494

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

workspaces/arborist/lib/node.js

+3
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ class Node {
11491149
for (const kid of node.children.values()) {
11501150
kid.parent = this
11511151
}
1152+
if (node.isLink && node.target) {
1153+
node.target.root = null
1154+
}
11521155
}
11531156

11541157
if (!node.isRoot) {

workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs

-26
Original file line numberDiff line numberDiff line change
@@ -2228,19 +2228,6 @@ ArboristNode {
22282228
"type": "prod",
22292229
},
22302230
},
2231-
"fsChildren": Set {
2232-
ArboristNode {
2233-
"dev": true,
2234-
"extraneous": true,
2235-
"location": "target",
2236-
"name": "target",
2237-
"optional": true,
2238-
"packageName": "ABBREV",
2239-
"path": "{CWD}/test/arborist/tap-testdir-reify-collide-case-variant-dep-names/target",
2240-
"peer": true,
2241-
"version": "1.0.0",
2242-
},
2243-
},
22442231
"isProjectRoot": true,
22452232
"location": "",
22462233
"name": "tap-testdir-reify-collide-case-variant-dep-names",
@@ -2275,19 +2262,6 @@ ArboristNode {
22752262
"type": "prod",
22762263
},
22772264
},
2278-
"fsChildren": Set {
2279-
ArboristNode {
2280-
"dev": true,
2281-
"extraneous": true,
2282-
"location": "target",
2283-
"name": "target",
2284-
"optional": true,
2285-
"packageName": "ABBREV",
2286-
"path": "{CWD}/test/arborist/tap-testdir-reify-collide-case-variant-dep-names/target",
2287-
"peer": true,
2288-
"version": "1.0.0",
2289-
},
2290-
},
22912265
"isProjectRoot": true,
22922266
"location": "",
22932267
"name": "tap-testdir-reify-collide-case-variant-dep-names",

0 commit comments

Comments
 (0)