@@ -139,7 +139,7 @@ async function run(): Promise<void> {
139139 const value = flag . split ( '=' ) [ 1 ] ;
140140 const trimmedValue = value ?. trim ( ) ;
141141 if ( trimmedValue ) {
142- variantLabel = value ;
142+ variantLabel = trimmedValue ;
143143 } else {
144144 console . warn ( 'Warning: --variant= specified but no value provided. Ignoring variant flag.' ) ;
145145 }
@@ -152,7 +152,7 @@ async function run(): Promise<void> {
152152 const value = allTestFlags [ index + 1 ] ;
153153 const trimmedValue = value ?. trim ( ) ;
154154 if ( trimmedValue ) {
155- variantLabel = value ;
155+ variantLabel = trimmedValue ;
156156 skipNextFlag = true ; // Mark next flag to be skipped
157157 } else {
158158 console . warn ( 'Warning: --variant specified but no value provided. Ignoring variant flag.' ) ;
@@ -217,16 +217,16 @@ async function run(): Promise<void> {
217217
218218 // Print which variant we're using if found
219219 if ( matchedVariantLabel ) {
220- console . log ( `Using variant: "${ matchedVariantLabel } "` ) ;
220+ console . log ( `\n\nUsing variant: "${ matchedVariantLabel } "\n\n ` ) ;
221221 }
222222
223223 console . log ( `Building ${ testLabel } in ${ tmpDirPath } ...` ) ;
224- await asyncExec ( buildCommand , { env, cwd } ) ;
224+ await asyncExec ( `volta run ${ buildCommand } ` , { env, cwd } ) ;
225225
226226 console . log ( `Testing ${ testLabel } ...` ) ;
227- // Append test flags to assert command
228- const fullAssertCommand = testFlags . length > 0 ? ` ${ assertCommand } ${ testFlags . join ( ' ' ) } ` : assertCommand ;
229- await asyncExec ( fullAssertCommand , { env, cwd } ) ;
227+ // Pass command and arguments as an array to prevent command injection
228+ const testCommand = [ 'volta' , 'run' , ... assertCommand . split ( ' ' ) , ... testFlags ] ;
229+ await asyncExec ( testCommand , { env, cwd } ) ;
230230
231231 // clean up (although this is tmp, still nice to do)
232232 await rm ( tmpDirPath , { recursive : true } ) ;
0 commit comments