fix(query): support package-lock-only in workspaces · npm/cli@8ab8668 · GitHub
Skip to content

Commit 8ab8668

Browse files
watildeowlstronaut
authored andcommitted
fix(query): support package-lock-only in workspaces
1 parent 0765289 commit 8ab8668

3 files changed

Lines changed: 160 additions & 9 deletions

File tree

lib/commands/query.js

Lines changed: 22 additions & 9 deletions

tap-snapshots/test/lib/commands/query.js.test.cjs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ exports[`test/lib/commands/query.js TAP missing > should return missing node 1`]
124124
]
125125
`
126126

127+
exports[`test/lib/commands/query.js TAP package-lock-only missing workspace in tree > should return empty array for missing workspace 1`] = `
128+
[]
129+
`
130+
127131
exports[`test/lib/commands/query.js TAP package-lock-only with package lock > should return valid response with only lock info 1`] = `
128132
[
129133
{
@@ -172,6 +176,48 @@ exports[`test/lib/commands/query.js TAP package-lock-only with package lock > sh
172176
]
173177
`
174178

179+
exports[`test/lib/commands/query.js TAP package-lock-only with package lock and workspace > should return workspace object with package-lock-only 1`] = `
180+
[
181+
{
182+
"name": "root",
183+
"workspaces": [
184+
"packages/*"
185+
],
186+
"pkgid": "root@",
187+
"location": "",
188+
"path": "{CWD}/prefix",
189+
"realpath": "{CWD}/prefix",
190+
"resolved": null,
191+
"from": [],
192+
"to": [
193+
"node_modules/a"
194+
],
195+
"dev": false,
196+
"inBundle": false,
197+
"deduped": false,
198+
"overridden": false,
199+
"queryContext": {}
200+
},
201+
{
202+
"name": "a",
203+
"version": "1.0.0",
204+
"_id": "a@1.0.0",
205+
"pkgid": "a@1.0.0",
206+
"location": "packages/a",
207+
"path": "{CWD}/prefix/packages/a",
208+
"realpath": "{CWD}/prefix/packages/a",
209+
"resolved": null,
210+
"from": [],
211+
"to": [],
212+
"dev": false,
213+
"inBundle": false,
214+
"deduped": false,
215+
"overridden": false,
216+
"queryContext": {}
217+
}
218+
]
219+
`
220+
175221
exports[`test/lib/commands/query.js TAP recursive tree > should return everything in the tree, accounting for recursion 1`] = `
176222
[
177223
{

test/lib/commands/query.js

Lines changed: 92 additions & 0 deletions

0 commit comments

Comments
 (0)