From 3d964940f410052918e37a9b05818fe9dc4cd86a Mon Sep 17 00:00:00 2001 From: nlf Date: Wed, 13 Apr 2022 15:03:37 -0700 Subject: [PATCH] fix(arborist): when replacing a Link with a Node, make sure to remove the Link target from the root --- workspaces/arborist/lib/node.js | 3 +++ .../test/arborist/reify.js.test.cjs | 26 ------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/workspaces/arborist/lib/node.js b/workspaces/arborist/lib/node.js index c79bc0bd3a00b..abd54ffe9725a 100644 --- a/workspaces/arborist/lib/node.js +++ b/workspaces/arborist/lib/node.js @@ -1149,6 +1149,9 @@ class Node { for (const kid of node.children.values()) { kid.parent = this } + if (node.isLink && node.target) { + node.target.root = null + } } if (!node.isRoot) { diff --git a/workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs b/workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs index 49b02273ec59f..32b02494f7cf2 100644 --- a/workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/arborist/reify.js.test.cjs @@ -2228,19 +2228,6 @@ ArboristNode { "type": "prod", }, }, - "fsChildren": Set { - ArboristNode { - "dev": true, - "extraneous": true, - "location": "target", - "name": "target", - "optional": true, - "packageName": "ABBREV", - "path": "{CWD}/test/arborist/tap-testdir-reify-collide-case-variant-dep-names/target", - "peer": true, - "version": "1.0.0", - }, - }, "isProjectRoot": true, "location": "", "name": "tap-testdir-reify-collide-case-variant-dep-names", @@ -2275,19 +2262,6 @@ ArboristNode { "type": "prod", }, }, - "fsChildren": Set { - ArboristNode { - "dev": true, - "extraneous": true, - "location": "target", - "name": "target", - "optional": true, - "packageName": "ABBREV", - "path": "{CWD}/test/arborist/tap-testdir-reify-collide-case-variant-dep-names/target", - "peer": true, - "version": "1.0.0", - }, - }, "isProjectRoot": true, "location": "", "name": "tap-testdir-reify-collide-case-variant-dep-names",