%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
const flatOptions = { global: false } const npm = { flatOptions } const t = require('tap') const { resolve } = require('path') const p = '../../../../lib/utils/completion/installed-shallow.js' const installed = require(p) t.test('global not set, include globals with -g', async t => { const dir = t.testdir({ global: { node_modules: { x: {}, '@scope': { y: {}, }, }, }, local: { node_modules: { a: {}, '@scope': { b: {}, }, }, }, }) npm.globalDir = resolve(dir, 'global/node_modules') npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = false const opt = { conf: { argv: { remain: [] } } } const res = await installed(npm, opt) t.strictSame(res.sort(), [ '@scope/y -g', 'x -g', 'a', '@scope/b', ].sort()) t.end() }) t.test('global set, include globals and not locals', async t => { const dir = t.testdir({ global: { node_modules: { x: {}, '@scope': { y: {}, }, }, }, local: { node_modules: { a: {}, '@scope': { b: {}, }, }, }, }) npm.globalDir = resolve(dir, 'global/node_modules') npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = true const opt = { conf: { argv: { remain: [] } } } const res = await installed(npm, opt) t.strictSame(res.sort(), [ '@scope/y', 'x', ].sort()) t.end() }) t.test('more than 3 items in argv, skip it', async t => { const dir = t.testdir({ global: { node_modules: { x: {}, '@scope': { y: {}, }, }, }, local: { node_modules: { a: {}, '@scope': { b: {}, }, }, }, }) npm.globalDir = resolve(dir, 'global/node_modules') npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = false const opt = { conf: { argv: { remain: [1, 2, 3, 4, 5, 6] } } } const res = await installed(npm, opt) t.strictSame(res, null) t.end() })