@@ -427,11 +427,14 @@ export function computeTestCommand(
427
427
addJSONFlag : boolean | undefined ; // true if we add extra -json flag for stream processing.
428
428
} {
429
429
const args : Array < string > = [ 'test' ] ;
430
+ const outArgs :Array < string > = [ 'test' ] ; // command to show
430
431
// user-specified flags
431
432
const argsFlagIdx = testconfig . flags ?. indexOf ( '-args' ) ?? - 1 ;
432
433
const userFlags = argsFlagIdx < 0 ? testconfig . flags : testconfig . flags . slice ( 0 , argsFlagIdx ) ;
433
434
const userArgsFlags = argsFlagIdx < 0 ? [ ] : testconfig . flags . slice ( argsFlagIdx ) ;
434
435
436
+ args . push ( ...targets ) ;
437
+
435
438
// flags to limit test time
436
439
if ( testconfig . isBenchmark ) {
437
440
args . push ( '-benchmem' , '-run=^$' ) ;
@@ -469,32 +472,29 @@ export function computeTestCommand(
469
472
// all other test run/benchmark flags
470
473
args . push ( ...targetArgs ( testconfig ) ) ;
471
474
472
- const outArgs = args . slice ( 0 ) ; // command to show
473
-
474
475
// if user set -v, set -json to emulate streaming test output
475
476
const addJSONFlag = ( userFlags . includes ( '-v' ) || testconfig . goTestOutputConsumer ) && ! userFlags . includes ( '-json' ) ;
476
477
if ( addJSONFlag ) {
477
478
args . push ( '-json' ) ; // this is not shown to the user.
478
479
}
479
480
480
- if ( targets . length > 4 ) {
481
- outArgs . push ( '<long arguments omitted>' ) ;
482
- } else {
483
- outArgs . push ( ...targets ) ;
484
- }
485
- args . push ( ...targets ) ;
486
-
487
481
// ensure that user provided flags are appended last (allow use of -args ...)
488
482
// ignore user provided -run flag if we are already using it
489
483
if ( args . indexOf ( '-run' ) > - 1 ) {
490
484
removeRunFlag ( userFlags ) ;
491
485
}
492
486
493
487
args . push ( ...userFlags ) ;
494
- outArgs . push ( ...userFlags ) ;
495
-
496
488
args . push ( ...userArgsFlags ) ;
497
- outArgs . push ( ...userArgsFlags ) ;
489
+
490
+ // build outArgs
491
+ if ( targets . length > 4 ) {
492
+ outArgs . push ( '<long arguments omitted>' ) ;
493
+ } else {
494
+ outArgs . push ( ...targets ) ;
495
+ }
496
+
497
+ outArgs . push ( ...args . slice ( targets . length + 1 ) ) ;
498
498
499
499
return {
500
500
args,
0 commit comments