@@ -294,23 +294,28 @@ suite('Debug/Launch interface', () => {
294294
295295 const terminal = await cmakeProject . launchTarget ( ) ;
296296 expect ( terminal ) . to . be . not . null ;
297- expect ( terminal ! . name ) . to . eq ( `CMake/Launch - ${ executablesTargets [ 0 ] . name } ` ) ;
298297
299- const start = new Date ( ) ;
300- // Needed to get launch target result
301- await new Promise ( resolve => setTimeout ( resolve , 3000 ) ) ;
298+ try {
299+ // Use creationOptions.name — terminal.name may be dynamically
300+ // overridden by the shell process title in newer VS Code versions.
301+ expect ( terminal ! . creationOptions . name ) . to . eq ( `CMake/Launch - ${ executablesTargets [ 0 ] . name } ` ) ;
302302
303- const elapsed = ( new Date ( ) . getTime ( ) - start . getTime ( ) ) / 1000 ;
304- console . log ( `Waited ${ elapsed } seconds for output file to appear` ) ;
303+ const start = new Date ( ) ;
304+ // Needed to get launch target result
305+ await new Promise ( resolve => setTimeout ( resolve , 3000 ) ) ;
305306
306- const exists = fs . existsSync ( createdFileOnExecution ) ;
307- // Check that it is compiled as a new file
308- expect ( exists ) . to . be . true ;
307+ const elapsed = ( new Date ( ) . getTime ( ) - start . getTime ( ) ) / 1000 ;
308+ console . log ( `Waited ${ elapsed } seconds for output file to appear` ) ;
309309
310- terminal ?. dispose ( ) ;
310+ const exists = fs . existsSync ( createdFileOnExecution ) ;
311+ // Check that it is compiled as a new file
312+ expect ( exists ) . to . be . true ;
313+ } finally {
314+ terminal ?. dispose ( ) ;
311315
312- // Needed to ensure things get disposed
313- await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
316+ // Needed to ensure things get disposed
317+ await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
318+ }
314319 } ) . timeout ( 60000 ) ;
315320
316321 test ( 'Test launch same target multiple times when newTerminal run is enabled' , async ( ) => {
@@ -341,17 +346,23 @@ suite('Debug/Launch interface', () => {
341346
342347 const term2 = await cmakeProject . launchTarget ( ) ;
343348 expect ( term2 ) . to . be . not . null ;
344- expect ( term2 ! . name ) . to . eq (
345- `CMake/Launch - ${ executablesTargets [ 0 ] . name } `
346- ) ;
347-
348- const term2Pid = await term2 ?. processId ;
349- expect ( term1Pid ) . to . not . eq ( term2Pid ) ;
350- term1 ?. dispose ( ) ;
351- term2 ?. dispose ( ) ;
352349
353- // Needed to ensure things get disposed
354- await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
350+ try {
351+ // Use creationOptions.name — terminal.name may be dynamically
352+ // overridden by the shell process title in newer VS Code versions.
353+ expect ( term2 ! . creationOptions . name ) . to . eq (
354+ `CMake/Launch - ${ executablesTargets [ 0 ] . name } `
355+ ) ;
356+
357+ const term2Pid = await term2 ?. processId ;
358+ expect ( term1Pid ) . to . not . eq ( term2Pid ) ;
359+ } finally {
360+ term1 ?. dispose ( ) ;
361+ term2 ?. dispose ( ) ;
362+
363+ // Needed to ensure things get disposed
364+ await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
365+ }
355366 } ) . timeout ( 60000 ) ;
356367
357368 test ( 'Test launch same target multiple times when newTerminal run is disabled' , async ( ) => {
0 commit comments