@@ -124,11 +124,12 @@ t.test('npx foo, bin already exists locally', async t => {
124
124
PROGRESS_IGNORED = true
125
125
npm . localBin = path
126
126
127
- await exec ( [ 'foo' ] , er => {
127
+ await exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
128
128
t . ifError ( er , 'npm exec' )
129
129
} )
130
130
t . match ( RUN_SCRIPTS , [ {
131
131
pkg : { scripts : { npx : 'foo' } } ,
132
+ args : [ 'one arg' , 'two arg' ] ,
132
133
banner : false ,
133
134
path : process . cwd ( ) ,
134
135
stdioString : true ,
@@ -148,11 +149,12 @@ t.test('npx foo, bin already exists globally', async t => {
148
149
PROGRESS_IGNORED = true
149
150
npm . globalBin = path
150
151
151
- await exec ( [ 'foo' ] , er => {
152
+ await exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
152
153
t . ifError ( er , 'npm exec' )
153
154
} )
154
155
t . match ( RUN_SCRIPTS , [ {
155
156
pkg : { scripts : { npx : 'foo' } } ,
157
+ args : [ 'one arg' , 'two arg' ] ,
156
158
banner : false ,
157
159
path : process . cwd ( ) ,
158
160
stdioString : true ,
@@ -178,7 +180,7 @@ t.test('npm exec foo, already present locally', async t => {
178
180
} ,
179
181
_from : 'foo@' ,
180
182
}
181
- await exec ( [ 'foo' ] , er => {
183
+ await exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
182
184
if ( er )
183
185
throw er
184
186
} )
@@ -188,6 +190,7 @@ t.test('npm exec foo, already present locally', async t => {
188
190
t . equal ( PROGRESS_ENABLED , true , 'progress re-enabled' )
189
191
t . match ( RUN_SCRIPTS , [ {
190
192
pkg : { scripts : { npx : 'foo' } } ,
193
+ args : [ 'one arg' , 'two arg' ] ,
191
194
banner : false ,
192
195
path : process . cwd ( ) ,
193
196
stdioString : true ,
@@ -220,6 +223,7 @@ t.test('npm exec <noargs>, run interactive shell', async t => {
220
223
if ( doRun ) {
221
224
t . match ( RUN_SCRIPTS , [ {
222
225
pkg : { scripts : { npx : 'shell-cmd' } } ,
226
+ args : [ ] ,
223
227
banner : false ,
224
228
path : process . cwd ( ) ,
225
229
stdioString : true ,
@@ -281,7 +285,7 @@ t.test('npm exec foo, not present locally or in central loc', async t => {
281
285
} ,
282
286
_from : 'foo@' ,
283
287
}
284
- await exec ( [ 'foo' ] , er => {
288
+ await exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
285
289
if ( er )
286
290
throw er
287
291
} )
@@ -292,6 +296,7 @@ t.test('npm exec foo, not present locally or in central loc', async t => {
292
296
const PATH = `${ resolve ( installDir , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } `
293
297
t . match ( RUN_SCRIPTS , [ {
294
298
pkg : { scripts : { npx : 'foo' } } ,
299
+ args : [ 'one arg' , 'two arg' ] ,
295
300
banner : false ,
296
301
path : process . cwd ( ) ,
297
302
stdioString : true ,
@@ -319,7 +324,7 @@ t.test('npm exec foo, not present locally but in central loc', async t => {
319
324
} ,
320
325
_from : 'foo@' ,
321
326
}
322
- await exec ( [ 'foo' ] , er => {
327
+ await exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
323
328
if ( er )
324
329
throw er
325
330
} )
@@ -330,6 +335,7 @@ t.test('npm exec foo, not present locally but in central loc', async t => {
330
335
const PATH = `${ resolve ( installDir , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } `
331
336
t . match ( RUN_SCRIPTS , [ {
332
337
pkg : { scripts : { npx : 'foo' } } ,
338
+ args : [ 'one arg' , 'two arg' ] ,
333
339
banner : false ,
334
340
path : process . cwd ( ) ,
335
341
stdioString : true ,
@@ -357,7 +363,7 @@ t.test('npm exec foo, present locally but wrong version', async t => {
357
363
} ,
358
364
_from : 'foo@2.x' ,
359
365
}
360
- await exec ( [ 'foo@2.x' ] , er => {
366
+ await exec ( [ 'foo@2.x' , 'one arg' , 'two arg' ] , er => {
361
367
if ( er )
362
368
throw er
363
369
} )
@@ -368,6 +374,7 @@ t.test('npm exec foo, present locally but wrong version', async t => {
368
374
const PATH = `${ resolve ( installDir , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } `
369
375
t . match ( RUN_SCRIPTS , [ {
370
376
pkg : { scripts : { npx : 'foo' } } ,
377
+ args : [ 'one arg' , 'two arg' ] ,
371
378
banner : false ,
372
379
path : process . cwd ( ) ,
373
380
stdioString : true ,
@@ -392,7 +399,7 @@ t.test('npm exec --package=foo bar', async t => {
392
399
_from : 'foo@' ,
393
400
}
394
401
npm . flatOptions . package = [ 'foo' ]
395
- await exec ( [ 'bar' ] , er => {
402
+ await exec ( [ 'bar' , 'one arg' , 'two arg' ] , er => {
396
403
if ( er )
397
404
throw er
398
405
} )
@@ -402,6 +409,7 @@ t.test('npm exec --package=foo bar', async t => {
402
409
t . equal ( PROGRESS_ENABLED , true , 'progress re-enabled' )
403
410
t . match ( RUN_SCRIPTS , [ {
404
411
pkg : { scripts : { npx : 'bar' } } ,
412
+ args : [ 'one arg' , 'two arg' ] ,
405
413
banner : false ,
406
414
path : process . cwd ( ) ,
407
415
stdioString : true ,
@@ -442,6 +450,7 @@ t.test('npm exec @foo/bar -- --some=arg, locally installed', async t => {
442
450
t . equal ( PROGRESS_ENABLED , true , 'progress re-enabled' )
443
451
t . match ( RUN_SCRIPTS , [ {
444
452
pkg : { scripts : { npx : 'bar' } } ,
453
+ args : [ '--some=arg' ] ,
445
454
banner : false ,
446
455
path : process . cwd ( ) ,
447
456
stdioString : true ,
@@ -473,7 +482,7 @@ t.test('npm exec @foo/bar, with same bin alias and no unscoped named bin, locall
473
482
children : new Map ( [ [ '@foo/bar' , { name : '@foo/bar' , version : '1.2.3' } ] ] ) ,
474
483
}
475
484
MANIFESTS [ '@foo/bar' ] = foobarManifest
476
- await exec ( [ '@foo/bar' ] , er => {
485
+ await exec ( [ '@foo/bar' , 'one arg' , 'two arg' ] , er => {
477
486
if ( er )
478
487
throw er
479
488
} )
@@ -483,6 +492,7 @@ t.test('npm exec @foo/bar, with same bin alias and no unscoped named bin, locall
483
492
t . equal ( PROGRESS_ENABLED , true , 'progress re-enabled' )
484
493
t . match ( RUN_SCRIPTS , [ {
485
494
pkg : { scripts : { npx : 'baz' } } ,
495
+ args : [ 'one arg' , 'two arg' ] ,
486
496
banner : false ,
487
497
path : process . cwd ( ) ,
488
498
stdioString : true ,
@@ -552,7 +562,7 @@ t.test('run command with 2 packages, need install, verify sort', t => {
552
562
} ,
553
563
_from : 'bar@' ,
554
564
}
555
- await exec ( [ 'foobar' ] , er => {
565
+ await exec ( [ 'foobar' , 'one arg' , 'two arg' ] , er => {
556
566
if ( er )
557
567
throw er
558
568
} )
@@ -563,6 +573,7 @@ t.test('run command with 2 packages, need install, verify sort', t => {
563
573
const PATH = `${ resolve ( installDir , 'node_modules' , '.bin' ) } ${ delimiter } ${ process . env . PATH } `
564
574
t . match ( RUN_SCRIPTS , [ {
565
575
pkg : { scripts : { npx : 'foobar' } } ,
576
+ args : [ 'one arg' , 'two arg' ] ,
566
577
banner : false ,
567
578
path : process . cwd ( ) ,
568
579
stdioString : true ,
0 commit comments