Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornlf <quitlahok@gmail.com>2022-05-03 23:53:10 +0300
committerGitHub <noreply@github.com>2022-05-03 23:53:10 +0300
commitb9a966cf33cfa9b1e5f16c16219f63633bbe19d6 (patch)
tree99f5dc1090bcf688e4601f1ecbb697b4ec48a85d /test
parent62af3a1dc003cf23c563d18437be81f61e65cb49 (diff)
fix(exec): ignore packageLockOnly flag (#4843)
Diffstat (limited to 'test')
-rw-r--r--test/lib/commands/exec.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/lib/commands/exec.js b/test/lib/commands/exec.js
index d6e598d56..1117885b9 100644
--- a/test/lib/commands/exec.js
+++ b/test/lib/commands/exec.js
@@ -385,6 +385,64 @@ t.test('npm exec foo, not present locally or in central loc', async t => {
])
})
+t.test('npm exec foo, packageLockOnly set to true', async t => {
+ const path = t.testdir()
+ const installDir = resolve('npx-cache-dir/f7fbba6e0636f890')
+ npm.localPrefix = path
+ npm.config.set('package-lock-only', true)
+ t.teardown(() => {
+ npm.config.set('package-lock-only', false)
+ })
+
+ ARB_ACTUAL_TREE[path] = {
+ inventory: {
+ query () {
+ return new Set()
+ },
+ },
+ }
+ ARB_ACTUAL_TREE[installDir] = {
+ inventory: {
+ query () {
+ return new Set()
+ },
+ },
+ }
+ MANIFESTS.foo = {
+ name: 'foo',
+ version: '1.2.3',
+ bin: {
+ foo: 'foo',
+ },
+ _from: 'foo@',
+ }
+ await exec.exec(['foo', 'one arg', 'two arg'])
+ t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
+ t.match(ARB_CTOR, [{
+ path,
+ packageLockOnly: false,
+ }])
+ t.match(ARB_REIFY, [{
+ add: ['foo@'],
+ legacyPeerDeps: false,
+ packageLockOnly: false,
+ }], 'need to install foo@')
+ t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
+ const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
+})
+
t.test('npm exec foo, not present locally but in central loc', async t => {
const path = t.testdir()
const installDir = resolve('npx-cache-dir/f7fbba6e0636f890')