@@ -408,6 +408,76 @@ suite('e3-testsuite', function () {
408408 reset ( spyCtrl ) ;
409409 }
410410 } ) ;
411+
412+ test ( 'Settings e3-testsuite.args' , async function ( ) {
413+ await e3 . controller . refreshHandler ! ( new CancellationTokenSource ( ) . token ) ;
414+
415+ // Get original configuration to restore later
416+ const config = workspace . getConfiguration ( 'e3-testsuite' ) ;
417+ const originalArgs = config . get < string [ ] > ( 'args' ) ;
418+
419+ try {
420+ // Set custom args in workspace configuration
421+ const testArgs = [ '--verbose' , '--show-time-info' ] ;
422+ await config . update ( 'args' , testArgs , false ) ;
423+
424+ const spyCtrl = spy ( e3 . controller ) ;
425+ try {
426+ const mockRun = mock < TestRun > ( ) ;
427+ let consoleOutput = '' ;
428+ when ( mockRun . appendOutput ( anything ( ) ) ) . thenCall ( ( output : string ) => {
429+ consoleOutput += output . replace ( / ( \r + \n | \n \r + ) / g, '\n' ) ;
430+ } ) ;
431+
432+ const run = instance ( mockRun ) ;
433+
434+ when ( spyCtrl . createTestRun ( anything ( ) ) ) . thenReturn ( run ) ;
435+ when ( spyCtrl . createTestRun ( anything ( ) , anything ( ) ) ) . thenReturn ( run ) ;
436+ when ( spyCtrl . createTestRun ( anything ( ) , anything ( ) , anything ( ) ) ) . thenReturn ( run ) ;
437+
438+ // Run the handler
439+ await e3 . runHandler (
440+ { include : undefined , exclude : undefined , profile : undefined } ,
441+ new CancellationTokenSource ( ) . token ,
442+ ) ;
443+
444+ // Check that the custom args appear in the console output
445+ assert . ok (
446+ consoleOutput . includes ( '--verbose' ) ,
447+ `Expected '--verbose' argument not found in console output: ${ consoleOutput } ` ,
448+ ) ;
449+ assert . ok (
450+ consoleOutput . includes ( '--show-time-info' ) ,
451+ `Expected '--show-time-info' argument not found in console output: ` +
452+ `${ consoleOutput } ` ,
453+ ) ;
454+
455+ // Verify the command line includes both the failure-exit-code and our custom args
456+ const commandLineRegex = / R u n n i n g : " .* p y t h o n .* " " .* t e s t s u i t e \. p y " " .* " / ;
457+ const match = consoleOutput . match ( commandLineRegex ) ;
458+ assert . ok ( match , `Command line not found in console output: ${ consoleOutput } ` ) ;
459+
460+ const commandLine = match [ 0 ] ;
461+ assert . ok (
462+ commandLine . includes ( '--failure-exit-code=0' ) ,
463+ `Expected '--failure-exit-code=0' not found in command: ${ commandLine } ` ,
464+ ) ;
465+ assert . ok (
466+ commandLine . includes ( '--verbose' ) ,
467+ `Expected '--verbose' not found in command: ${ commandLine } ` ,
468+ ) ;
469+ assert . ok (
470+ commandLine . includes ( '--show-time-info' ) ,
471+ `Expected '--show-time-info' not found in command: ${ commandLine } ` ,
472+ ) ;
473+ } finally {
474+ reset ( spyCtrl ) ;
475+ }
476+ } finally {
477+ // Always restore original configuration
478+ await config . update ( 'args' , originalArgs , false ) ;
479+ }
480+ } ) ;
411481} ) ;
412482
413483interface TestResultItem {
0 commit comments