node/deps/npm/test/lib/commands/get.js
npm CLI robot 10172e394b
deps: upgrade npm to 11.10.1
PR-URL: https://github.com/nodejs/node/pull/61892
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-02-22 00:19:51 +00:00

22 lines
596 B
JavaScript

const t = require('tap')
const { load: loadMockNpm } = require('../../fixtures/mock-npm')
t.test('completion', async t => {
const { get } = await loadMockNpm(t, { command: 'get' })
const res = await get.completion({ conf: { argv: { remain: ['npm', 'get'] } } })
t.type(res, Array)
})
t.test('should retrieve values from config', async t => {
const name = 'editor'
const value = 'vigor'
const { joinedOutput, npm } = await loadMockNpm(t, {
config: { [name]: value },
})
await npm.exec('get', [name])
t.equal(
joinedOutput(),
value,
'outputs config item'
)
})