Skip to content

Commit 7350e96

Browse files
committed
fix(npx): always save true when installing to npx cache
1 parent 679bc4a commit 7350e96

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

workspaces/libnpmexec/lib/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ const exec = async (opts) => {
292292
}
293293
await npxArb.reify({
294294
...flatOptions,
295+
save: true,
295296
add,
296297
})
297298
}

workspaces/libnpmexec/test/registry.js

+22
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,25 @@ t.test('npx tree triggers manifest fetch when local version does satisfy range u
297297
value: 'packages-2.0.1',
298298
})
299299
})
300+
301+
t.test('override save to true when installing to npx cache', async t => {
302+
const { fixtures, package } = createPkg({ versions: ['2.0.0'] })
303+
304+
const { exec, path, registry, readOutput } = setup(t, {
305+
testdir: merge(fixtures, {
306+
global: {},
307+
}),
308+
})
309+
310+
await package({ registry, path })
311+
312+
await exec({
313+
args: ['@npmcli/create-index'],
314+
globalPath: resolve(path, 'global'),
315+
save: false,
316+
})
317+
318+
t.match(await readOutput('@npmcli-create-index'), {
319+
value: 'packages-2.0.0',
320+
})
321+
})

0 commit comments

Comments
 (0)