@@ -385,6 +385,66 @@ 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+ packageLock : false ,
424+ packageLockOnly : false ,
425+ } ] )
426+ t . match ( ARB_REIFY , [ {
427+ add : [ 'foo@' ] ,
428+ legacyPeerDeps : false ,
429+ packageLock : false ,
430+ packageLockOnly : false ,
431+ } ] , 'need to install foo@' )
432+ t . equal ( PROGRESS_ENABLED , true , 'progress re-enabled' )
433+ const PATH = `${ resolve ( installDir , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } `
434+ t . match ( RUN_SCRIPTS , [
435+ {
436+ pkg : { scripts : { npx : 'foo' } } ,
437+ args : [ 'one arg' , 'two arg' ] ,
438+ banner : false ,
439+ path : process . cwd ( ) ,
440+ stdioString : true ,
441+ event : 'npx' ,
442+ env : { PATH } ,
443+ stdio : 'inherit' ,
444+ } ,
445+ ] )
446+ } )
447+
388448t . test ( 'npm exec foo, not present locally but in central loc' , async t => {
389449 const path = t . testdir ( )
390450 const installDir = resolve ( 'npx-cache-dir/f7fbba6e0636f890' )
0 commit comments