@@ -545,11 +545,14 @@ export function computeTestCommand(
545
545
addJSONFlag : boolean | undefined ; // true if we add extra -json flag for stream processing.
546
546
} {
547
547
const args : Array < string > = [ 'test' ] ;
548
+ const outArgs : Array < string > = [ 'test' ] ; // command to show
548
549
// user-specified flags
549
550
const argsFlagIdx = testconfig . flags ?. indexOf ( '-args' ) ?? - 1 ;
550
551
const userFlags = argsFlagIdx < 0 ? testconfig . flags : testconfig . flags . slice ( 0 , argsFlagIdx ) ;
551
552
const userArgsFlags = argsFlagIdx < 0 ? [ ] : testconfig . flags . slice ( argsFlagIdx ) ;
552
553
554
+ args . push ( ...targets ) ;
555
+
553
556
// flags to limit test time
554
557
if ( testconfig . isBenchmark ) {
555
558
args . push ( '-benchmem' , '-run=^$' ) ;
@@ -587,32 +590,29 @@ export function computeTestCommand(
587
590
// all other test run/benchmark flags
588
591
args . push ( ...targetArgs ( testconfig ) ) ;
589
592
590
- const outArgs = args . slice ( 0 ) ; // command to show
591
-
592
593
// if user set -v, set -json to emulate streaming test output
593
594
const addJSONFlag = ( userFlags . includes ( '-v' ) || testconfig . goTestOutputConsumer ) && ! userFlags . includes ( '-json' ) ;
594
595
if ( addJSONFlag ) {
595
596
args . push ( '-json' ) ; // this is not shown to the user.
596
597
}
597
598
598
- if ( targets . length > 4 ) {
599
- outArgs . push ( '<long arguments omitted>' ) ;
600
- } else {
601
- outArgs . push ( ...targets ) ;
602
- }
603
- args . push ( ...targets ) ;
604
-
605
599
// ensure that user provided flags are appended last (allow use of -args ...)
606
600
// ignore user provided -run flag if we are already using it
607
601
if ( args . indexOf ( '-run' ) > - 1 ) {
608
602
removeRunFlag ( userFlags ) ;
609
603
}
610
604
611
605
args . push ( ...userFlags ) ;
612
- outArgs . push ( ...userFlags ) ;
613
-
614
606
args . push ( ...userArgsFlags ) ;
615
- outArgs . push ( ...userArgsFlags ) ;
607
+
608
+ // build outArgs
609
+ if ( targets . length > 4 ) {
610
+ outArgs . push ( '<long arguments omitted>' ) ;
611
+ } else {
612
+ outArgs . push ( ...targets ) ;
613
+ }
614
+
615
+ outArgs . push ( ...args . slice ( targets . length + 1 ) ) ;
616
616
617
617
return {
618
618
args,
0 commit comments