@@ -55,6 +55,29 @@ function resolveMacOSExecutable(executablePath: string): string {
5555 return executablePath
5656}
5757
58+ async function downloadAndUnzipVSCodeRetry (
59+ testVsCodeVersion ,
60+ retries = 5 ,
61+ delay = 4000
62+ ) : Promise < string | undefined > {
63+ let backoff = delay
64+ for ( let i = 1 ; i <= retries ; i ++ ) {
65+ try {
66+ const vscodeExecutablePath =
67+ await downloadAndUnzipVSCode ( testVsCodeVersion )
68+ return vscodeExecutablePath
69+ } catch ( error ) {
70+ if ( i === retries ) {
71+ throw error
72+ } else {
73+ console . warn ( `Attempt ${ i } failed. Retrying in ${ backoff } ms...` )
74+ await new Promise ( ( r ) => setTimeout ( r , backoff ) )
75+ backoff = backoff * 2
76+ }
77+ }
78+ }
79+ }
80+
5881async function main ( ) {
5982 const disable_cert_verification =
6083 process . argv . includes ( '-k' ) ||
@@ -80,13 +103,14 @@ async function main() {
80103 // Passed to --extensionTestsPath
81104 const extensionTestsPath = path . resolve ( __dirname , './suite/index' )
82105
106+ // Download VS Code and retry upon error
83107 const downloadedExecutablePath =
84- await downloadAndUnzipVSCode ( testVsCodeVersion )
108+ await downloadAndUnzipVSCodeRetry ( testVsCodeVersion )
85109 const vscodeExecutablePath = resolveMacOSExecutable (
86- downloadedExecutablePath
110+ downloadedExecutablePath !
87111 )
88112
89- // Download VS Code, unzip it and run the integration tests
113+ // Run the integration tests
90114 const runTestsResult = await runTests ( {
91115 vscodeExecutablePath,
92116 extensionDevelopmentPath,
0 commit comments