@@ -464,6 +464,36 @@ exec "${chromeExePath}" \\
464464 await this . installVsix ( { useYarn : false , vsixFile : extension } ) ;
465465 }
466466
467+ /**
468+ * Installs a single VSIX file with platform-specific handling
469+ * @param vsixPath - Path to the VSIX file to install
470+ */
471+ private async installSingleVsix ( vsixPath : string ) : Promise < void > {
472+ let resolvedVsixPath = path . resolve ( vsixPath ) ;
473+
474+ // Avoid Windows paths being parsed as URLs by the tester
475+ if ( process . platform === 'win32' ) {
476+ resolvedVsixPath = resolvedVsixPath . replace ( / \\ / g, '/' ) ;
477+ if ( / ^ [ a - z A - Z ] : \/ / . test ( resolvedVsixPath ) ) {
478+ resolvedVsixPath = '/' + resolvedVsixPath ; // Prevent `new URL()` from treating it as a URL
479+ }
480+ }
481+
482+ // Use retry logic for Windows to handle file locking issues
483+ if ( process . platform === 'win32' ) {
484+ await retryOperation (
485+ async ( ) => {
486+ await new Promise ( resolve => setTimeout ( resolve , TestSetupAndRunner . RETRY_DELAY ) ) ;
487+ await this . installExtension ( resolvedVsixPath ) ;
488+ } ,
489+ TestSetupAndRunner . MAX_RETRIES ,
490+ `Failed to install extension ${ path . basename ( resolvedVsixPath ) } after retries due to Windows file locking issues`
491+ ) ;
492+ } else {
493+ await this . installExtension ( resolvedVsixPath ) ;
494+ }
495+ }
496+
467497 /**
468498 * Installs extensions from VSIX files
469499 * @param excludeExtensions - Array of extension IDs to exclude from installation
@@ -582,31 +612,9 @@ exec "${chromeExePath}" \\
582612 } ) ;
583613
584614 // Install extensions that have vsixPath and shouldInstall !== 'never'
585- for ( const [ _ , extensionConfig ] of extensionConfigsMap ) {
615+ for ( const extensionConfig of extensionConfigsMap . values ( ) ) {
586616 if ( extensionConfig . vsixPath && extensionConfig . shouldInstall !== 'never' ) {
587- let vsixPath = path . resolve ( extensionConfig . vsixPath ) ;
588-
589- // Avoid Windows paths being parsed as URLs by the tester
590- if ( process . platform === 'win32' ) {
591- vsixPath = vsixPath . replace ( / \\ / g, '/' ) ;
592- if ( / ^ [ a - z A - Z ] : \/ / . test ( vsixPath ) ) {
593- vsixPath = '/' + vsixPath ; // Prevent `new URL()` from treating it as a URL
594- }
595- }
596-
597- // Use retry logic for Windows to handle file locking issues
598- if ( process . platform === 'win32' ) {
599- await retryOperation (
600- async ( ) => {
601- await new Promise ( resolve => setTimeout ( resolve , TestSetupAndRunner . RETRY_DELAY ) ) ;
602- await this . installExtension ( vsixPath ) ;
603- } ,
604- TestSetupAndRunner . MAX_RETRIES ,
605- `Failed to install extension ${ path . basename ( vsixPath ) } after retries due to Windows file locking issues`
606- ) ;
607- } else {
608- await this . installExtension ( vsixPath ) ;
609- }
617+ await this . installSingleVsix ( extensionConfig . vsixPath ) ;
610618 }
611619 }
612620 } else {
@@ -626,29 +634,7 @@ exec "${chromeExePath}" \\
626634 log ( `SetUp - Installing extension ${ extension } version ${ version } ` ) ;
627635 }
628636
629- let resolvedVsixPath = path . resolve ( vsixPath ) ;
630-
631- // Avoid Windows paths being parsed as URLs by the tester
632- if ( process . platform === 'win32' ) {
633- resolvedVsixPath = resolvedVsixPath . replace ( / \\ / g, '/' ) ;
634- if ( / ^ [ a - z A - Z ] : \/ / . test ( resolvedVsixPath ) ) {
635- resolvedVsixPath = '/' + resolvedVsixPath ; // Prevent `new URL()` from treating it as a URL
636- }
637- }
638-
639- // Use retry logic for Windows to handle file locking issues
640- if ( process . platform === 'win32' ) {
641- await retryOperation (
642- async ( ) => {
643- await new Promise ( resolve => setTimeout ( resolve , TestSetupAndRunner . RETRY_DELAY ) ) ;
644- await this . installExtension ( resolvedVsixPath ) ;
645- } ,
646- TestSetupAndRunner . MAX_RETRIES ,
647- `Failed to install extension ${ path . basename ( resolvedVsixPath ) } after retries due to Windows file locking issues`
648- ) ;
649- } else {
650- await this . installExtension ( resolvedVsixPath ) ;
651- }
637+ await this . installSingleVsix ( vsixPath ) ;
652638 }
653639 }
654640 }
0 commit comments