A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/9bffa13e0b96efe1039d9075fdcb11d5946b2f90 below:

missing nodes (#7320) · npm/cli@9bffa13 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+57

-3

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+57

-3

lines changed Original file line number Diff line number Diff line change

@@ -113,10 +113,12 @@ class Query extends BaseCommand {

113 113

// builds a normalized inventory

114 114

buildResponse (items) {

115 115

for (const node of items) {

116 -

if (!this.#seen.has(node.target.location)) {

116 +

if (!node.target.location || !this.#seen.has(node.target.location)) {

117 117

const item = new QuerySelectorItem(node)

118 118

this.#response.push(item)

119 -

this.#seen.add(item.location)

119 +

if (node.target.location) {

120 +

this.#seen.add(item.location)

121 +

}

120 122

}

121 123

}

122 124

}

Original file line number Diff line number Diff line change

@@ -99,6 +99,31 @@ exports[`test/lib/commands/query.js TAP linked node > should return linked node

99 99

]

100 100

`

101 101 102 +

exports[`test/lib/commands/query.js TAP missing > should return missing node 1`] = `

103 +

[

104 +

{

105 +

"name": "b",

106 +

"version": "^1.0.0",

107 +

"_id": "b@^1.0.0",

108 +

"pkgid": "b@^1.0.0",

109 +

"path": null,

110 +

"realpath": null,

111 +

"resolved": null,

112 +

"from": [

113 +

""

114 +

],

115 +

"to": [],

116 +

"dev": true,

117 +

"inBundle": false,

118 +

"deduped": false,

119 +

"overridden": false,

120 +

"queryContext": {

121 +

"missing": true

122 +

}

123 +

}

124 +

]

125 +

`

126 + 102 127

exports[`test/lib/commands/query.js TAP package-lock-only with package lock > should return valid response with only lock info 1`] = `

103 128

[

104 129

{

Original file line number Diff line number Diff line change

@@ -320,3 +320,25 @@ t.test('expect entries', t => {

320 320

})

321 321

t.end()

322 322

})

323 + 324 +

t.test('missing', async t => {

325 +

const { npm, joinedOutput } = await loadMockNpm(t, {

326 +

prefixDir: {

327 +

node_modules: {

328 +

a: {

329 +

name: 'a',

330 +

version: '1.0.0',

331 +

},

332 +

},

333 +

'package.json': JSON.stringify({

334 +

name: 'project',

335 +

dependencies: {

336 +

a: '^1.0.0',

337 +

b: '^1.0.0',

338 +

},

339 +

}),

340 +

},

341 +

})

342 +

await npm.exec('query', [':missing'])

343 +

t.matchSnapshot(joinedOutput(), 'should return missing node')

344 +

})

Original file line number Diff line number Diff line change

@@ -257,7 +257,12 @@ class Results {

257 257

for (const edge of node.edgesOut.values()) {

258 258

if (edge.missing) {

259 259

const pkg = { name: edge.name, version: edge.spec }

260 -

res.push(new this.#targetNode.constructor({ pkg }))

260 +

const item = new this.#targetNode.constructor({ pkg })

261 +

item.queryContext = {

262 +

missing: true,

263 +

}

264 +

item.edgesIn = new Set([edge])

265 +

res.push(item)

261 266

}

262 267

}

263 268

return res

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4