Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions workspaces/libnpmexec/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const exec = async (opts) => {
const npxArb = new Arborist({
...flatOptions,
path: installDir,
global: false,
})
const lockPath = join(installDir, 'concurrency.lock')
const npxTree = await withLock(lockPath, () => npxArb.loadActual())
Expand Down
31 changes: 31 additions & 0 deletions workspaces/libnpmexec/test/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,34 @@ t.test('override save to true when installing to npx cache', async t => {
value: 'packages-2.0.0',
})
})

t.test('ignore inherited global config when installing to npx cache', async t => {
const { fixtures, package } = createPkg({ versions: ['2.0.0'] })

const hash = crypto.createHash('sha512')
.update('@npmcli/create-index')
.digest('hex')
.slice(0, 16)

const { exec, path, registry, readOutput } = setup(t, {
testdir: merge(fixtures, {
global: {},
}),
})

await package({ registry, path })

await exec({
args: ['@npmcli/create-index'],
globalPath: resolve(path, 'global'),
global: true,
})

const binPath = resolve(path, 'npxCache', hash, 'node_modules', '.bin')
t.ok(existsSync(binPath), 'bins should be linked at npxCache')
t.notOk(existsSync(resolve(path, 'npxCache', 'bin')), 'bins should not be linked globally')

t.match(await readOutput('@npmcli-create-index'), {
value: 'packages-2.0.0',
})
})
Loading