diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2022-01-21 22:47:47 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2022-01-26 23:43:27 +0300 |
commit | 1f853f8bf7cecd1222703dde676a4b664526141d (patch) | |
tree | b47082af0aae08ce7adc0018e6078972f3f6ec45 /workspaces/arborist/test | |
parent | 081362558c5b310cf1660d3a5b5a2debb15195d2 (diff) |
fix(arborist): load actual tree on named updates
Arborist was not loading the actual tree when using named updates for
global updates, that would result in removing all previously installed
deps from a global install anytime the user would try to run
`npm update <pkgname>`.
This changeset fixes the problem by allowing the load of the actual tree
if the `global` and `update.names` options are defined.
Added a few more tests to illustrate but some of the snapshots already
included were actually demonstrating the problem by having empty trees
as result, these are now also updated with the expected tree result.
Fixes: https://github.com/npm/cli/issues/3175
Diffstat (limited to 'workspaces/arborist/test')
-rw-r--r-- | workspaces/arborist/test/arborist/build-ideal-tree.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/workspaces/arborist/test/arborist/build-ideal-tree.js b/workspaces/arborist/test/arborist/build-ideal-tree.js index 2c058a6a3..d8bfe8200 100644 --- a/workspaces/arborist/test/arborist/build-ideal-tree.js +++ b/workspaces/arborist/test/arborist/build-ideal-tree.js @@ -2092,6 +2092,10 @@ t.test('update global', async t => { }, }, }) + + t.matchSnapshot(await printIdeal(path, { global: true, update: ['abbrev'] }), + 'updating missing dep should have no effect') + t.matchSnapshot(await printIdeal(path, { global: true, update: ['wrappy'] }), 'updating sub-dep has no effect') t.matchSnapshot(await printIdeal(path, { global: true, update: ['once'] }), |