diff --git a/lib/download.test.ts b/lib/download.test.ts index 166e166b..ad799c83 100644 --- a/lib/download.test.ts +++ b/lib/download.test.ts @@ -29,30 +29,32 @@ describe('sane downloads', () => { await fs.mkdir(testTempDir, { recursive: true }); }); - for (const platform of platforms) { - test.concurrent(platform, async () => { - const location = await downloadAndUnzipVSCode({ - platform, - version: 'stable', - cachePath: testTempDir, - reporter: new SilentReporter(), + for (const quality of ['insiders', 'stable']) { + for (const platform of platforms) { + test.concurrent(`${quality}/${platform}`, async () => { + const location = await downloadAndUnzipVSCode({ + platform, + version: quality, + cachePath: testTempDir, + reporter: new SilentReporter(), + }); + + if (!existsSync(location)) { + throw new Error(`expected ${location} to exist for ${platform}`); + } + + const exePath = resolveCliPathFromVSCodeExecutablePath(location, platform); + if (!existsSync(exePath)) { + throw new Error(`expected ${exePath} to from ${location}`); + } + + if (platform === systemDefaultPlatform) { + const version = spawnSync(exePath, ['--version']); + expect(version.status).to.equal(0); + expect(version.stdout.toString().trim()).to.not.be.empty; + } }); - - if (!existsSync(location)) { - throw new Error(`expected ${location} to exist for ${platform}`); - } - - const exePath = resolveCliPathFromVSCodeExecutablePath(location, platform); - if (!existsSync(exePath)) { - throw new Error(`expected ${exePath} to from ${location}`); - } - - if (platform === systemDefaultPlatform) { - const version = spawnSync(exePath, ['--version']); - expect(version.status).to.equal(0); - expect(version.stdout.toString().trim()).to.not.be.empty; - } - }); + } } afterAll(async () => { @@ -64,7 +66,7 @@ describe('sane downloads', () => { }); }); -describe('fetchTargetInferredVersion', () => { +describe.skip('fetchTargetInferredVersion', () => { let stable: string[]; let insiders: string[]; let extensionsDevelopmentPath = join(tmpdir(), 'vscode-test-tmp-workspace'); diff --git a/lib/download.ts b/lib/download.ts index 7e42b8d3..c71a2eb8 100644 --- a/lib/download.ts +++ b/lib/download.ts @@ -189,6 +189,20 @@ interface IDownload { length: number; } +function getFilename(contentDisposition: string) { + const parts = contentDisposition.split(';').map((s) => s.trim()); + + for (const part of parts) { + const match = /^filename="?([^"]*)"?$/i.exec(part); + + if (match) { + return match[1]; + } + } + + return undefined; +} + /** * Download a copy of VS Code archive to `.vscode-test`. * @@ -219,8 +233,9 @@ async function downloadVSCodeArchive(options: DownloadOptions): Promise