@@ -385,6 +385,64 @@ t.test('npm exec foo, not present locally or in central loc', async t => {
385385 ] )
386386} )
387387
388+ t . test ( 'npm exec foo, packageLockOnly set to true' , async t => {
389+ const path = t . testdir ( )
390+ const installDir = resolve ( 'npx-cache-dir/f7fbba6e0636f890' )
391+ npm . localPrefix = path
392+ npm . config . set ( 'package-lock-only' , true )
393+ t . teardown ( ( ) => {
394+ npm . config . set ( 'package-lock-only' , false )
395+ } )
396+
397+ ARB_ACTUAL_TREE [ path ] = {
398+ inventory : {
399+ query ( ) {
400+ return new Set ( )
401+ } ,
402+ } ,
403+ }
404+ ARB_ACTUAL_TREE [ installDir ] = {
405+ inventory : {
406+ query ( ) {
407+ return new Set ( )
408+ } ,
409+ } ,
410+ }
411+ MANIFESTS . foo = {
412+ name : 'foo' ,
413+ version : '1.2.3' ,
414+ bin : {
415+ foo : 'foo' ,
416+ } ,
417+ _from : 'foo@' ,
418+ }
419+ await exec . exec ( [ 'foo' , 'one arg' , 'two arg' ] )
420+ t . strictSame ( MKDIRPS , [ installDir ] , 'need to make install dir' )
421+ t . match ( ARB_CTOR , [ {
422+ path,
423+ packageLockOnly : false ,
424+ } ] )
425+ t . match ( ARB_REIFY , [ {
426+ add : [ 'foo@' ] ,
427+ legacyPeerDeps : false ,
428+ packageLockOnly : false ,
429+ } ] , 'need to install foo@' )
430+ t . equal ( PROGRESS_ENABLED , true , 'progress re-enabled' )
431+ const PATH = `${ resolve ( installDir , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } `
432+ t . match ( RUN_SCRIPTS , [
433+ {
434+ pkg : { scripts : { npx : 'foo' } } ,
435+ args : [ 'one arg' , 'two arg' ] ,
436+ banner : false ,
437+ path : process . cwd ( ) ,
438+ stdioString : true ,
439+ event : 'npx' ,
440+ env : { PATH } ,
441+ stdio : 'inherit' ,
442+ } ,
443+ ] )
444+ } )
445+
388446t . test ( 'npm exec foo, not present locally but in central loc' , async t => {
389447 const path = t . testdir ( )
390448 const installDir = resolve ( 'npx-cache-dir/f7fbba6e0636f890' )
0 commit comments