@vscode/test-electron
Advanced tools
Comparing version 2.1.1 to 2.1.2
# Changelog | ||
### 2.1.2 | TBD | ||
- Fix executable path being returned incorrectly on cross-platform downloads | ||
- Fix tests sometimes failing with EACCESS errors on OSX | ||
### 2.1.1 | 2021-01-20 | ||
@@ -4,0 +9,0 @@ |
export declare function rmdir(dir: string): Promise<void>; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { ProgressReporter } from './progress'; |
@@ -57,2 +57,4 @@ "use strict"; | ||
const totalBytes = Number(download.headers['content-length']); | ||
const contentType = download.headers['content-type']; | ||
const isZip = contentType ? contentType === 'application/zip' : url.endsWith('.zip'); | ||
(_b = options.reporter) === null || _b === void 0 ? void 0 : _b.report({ stage: progress_1.ProgressReportStage.Downloading, url, bytesSoFar: 0, totalBytes }); | ||
@@ -69,3 +71,3 @@ let bytesSoFar = 0; | ||
}); | ||
return { stream: download, format: url.endsWith('.zip') ? 'zip' : 'tgz' }; | ||
return { stream: download, format: isZip ? 'zip' : 'tgz' }; | ||
} | ||
@@ -164,7 +166,7 @@ /** | ||
reporter.report({ stage: progress_1.ProgressReportStage.FetchingInsidersMetadata }); | ||
const { version: currentHash, date: currentDate } = util_2.insidersDownloadDirMetadata(downloadedPath); | ||
const { version: currentHash, date: currentDate } = util_2.insidersDownloadDirMetadata(downloadedPath, platform); | ||
const { version: latestHash, timestamp: latestTimestamp } = await util_2.getLatestInsidersMetadata(util_2.systemDefaultPlatform); | ||
if (currentHash === latestHash) { | ||
reporter.report({ stage: progress_1.ProgressReportStage.FoundMatchingInstall, downloadedPath }); | ||
return Promise.resolve(util_2.insidersDownloadDirToExecutablePath(downloadedPath)); | ||
return Promise.resolve(util_2.insidersDownloadDirToExecutablePath(downloadedPath, platform)); | ||
} | ||
@@ -191,3 +193,3 @@ else { | ||
reporter.report({ stage: progress_1.ProgressReportStage.FoundMatchingInstall, downloadedPath }); | ||
return Promise.resolve(util_2.downloadDirToExecutablePath(downloadedPath)); | ||
return Promise.resolve(util_2.downloadDirToExecutablePath(downloadedPath, platform)); | ||
} | ||
@@ -205,6 +207,6 @@ } | ||
if (version === 'insiders') { | ||
return Promise.resolve(util_2.insidersDownloadDirToExecutablePath(downloadedPath)); | ||
return Promise.resolve(util_2.insidersDownloadDirToExecutablePath(downloadedPath, platform)); | ||
} | ||
else { | ||
return util_2.downloadDirToExecutablePath(downloadedPath); | ||
return util_2.downloadDirToExecutablePath(downloadedPath, platform); | ||
} | ||
@@ -211,0 +213,0 @@ } |
@@ -0,0 +0,0 @@ export { download, downloadAndUnzipVSCode } from './download'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** Stages of progress while downloading VS Code */ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { DownloadVersion, DownloadPlatform } from './download'; |
@@ -77,4 +77,6 @@ "use strict"; | ||
} | ||
console.log('Done\n'); | ||
resolve(code !== null && code !== void 0 ? code : -1); | ||
else { | ||
console.log('Done\n'); | ||
resolve(code !== null && code !== void 0 ? code : -1); | ||
} | ||
} | ||
@@ -81,0 +83,0 @@ cmd.on('close', onProcessClosed); |
@@ -9,5 +9,5 @@ /// <reference types="node" /> | ||
export declare function urlToOptions(url: string): https.RequestOptions; | ||
export declare function downloadDirToExecutablePath(dir: string): string; | ||
export declare function insidersDownloadDirToExecutablePath(dir: string): string; | ||
export declare function insidersDownloadDirMetadata(dir: string): { | ||
export declare function downloadDirToExecutablePath(dir: string, platform: DownloadPlatform): string; | ||
export declare function insidersDownloadDirToExecutablePath(dir: string, platform: DownloadPlatform): string; | ||
export declare function insidersDownloadDirMetadata(dir: string, platform: DownloadPlatform): { | ||
version: any; | ||
@@ -31,3 +31,3 @@ date: Date; | ||
*/ | ||
export declare function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath: string): string; | ||
export declare function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath: string, platform: DownloadPlatform): string; | ||
/** | ||
@@ -51,2 +51,2 @@ * Resolve the VS Code cli arguments from executable path returned from `downloadAndUnzipVSCode`. | ||
*/ | ||
export declare function resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath: string, options?: Pick<TestOptions, 'reuseMachineInstall'>): string[]; | ||
export declare function resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath: string, options?: Pick<TestOptions, 'reuseMachineInstall' | 'platform'>): string[]; |
@@ -70,7 +70,7 @@ "use strict"; | ||
exports.urlToOptions = urlToOptions; | ||
function downloadDirToExecutablePath(dir) { | ||
if (process.platform === 'win32') { | ||
function downloadDirToExecutablePath(dir, platform) { | ||
if (platform === 'win32-archive' || platform === 'win32-x64-archive') { | ||
return path.resolve(dir, 'Code.exe'); | ||
} | ||
else if (process.platform === 'darwin') { | ||
else if (platform === 'darwin') { | ||
return path.resolve(dir, 'Visual Studio Code.app/Contents/MacOS/Electron'); | ||
@@ -83,7 +83,7 @@ } | ||
exports.downloadDirToExecutablePath = downloadDirToExecutablePath; | ||
function insidersDownloadDirToExecutablePath(dir) { | ||
if (process.platform === 'win32') { | ||
function insidersDownloadDirToExecutablePath(dir, platform) { | ||
if (platform === 'win32-archive' || platform === 'win32-x64-archive') { | ||
return path.resolve(dir, 'Code - Insiders.exe'); | ||
} | ||
else if (process.platform === 'darwin') { | ||
else if (platform === 'darwin') { | ||
return path.resolve(dir, 'Visual Studio Code - Insiders.app/Contents/MacOS/Electron'); | ||
@@ -96,8 +96,8 @@ } | ||
exports.insidersDownloadDirToExecutablePath = insidersDownloadDirToExecutablePath; | ||
function insidersDownloadDirMetadata(dir) { | ||
function insidersDownloadDirMetadata(dir, platform) { | ||
let productJsonPath; | ||
if (process.platform === 'win32') { | ||
if (platform === 'win32-archive' || platform === 'win32-x64-archive') { | ||
productJsonPath = path.resolve(dir, 'resources/app/product.json'); | ||
} | ||
else if (process.platform === 'darwin') { | ||
else if (platform === 'darwin') { | ||
productJsonPath = path.resolve(dir, 'Visual Studio Code - Insiders.app/Contents/Resources/app/product.json'); | ||
@@ -124,4 +124,4 @@ } | ||
*/ | ||
function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath) { | ||
if (process.platform === 'win32') { | ||
function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath, platform) { | ||
if (platform === 'win32-archive' || platform === 'win32-x64-archive') { | ||
if (vscodeExecutablePath.endsWith('Code - Insiders.exe')) { | ||
@@ -134,3 +134,3 @@ return path.resolve(vscodeExecutablePath, '../bin/code-insiders.cmd'); | ||
} | ||
else if (process.platform === 'darwin') { | ||
else if (platform === 'darwin') { | ||
return path.resolve(vscodeExecutablePath, '../../../Contents/Resources/app/bin/code'); | ||
@@ -167,3 +167,4 @@ } | ||
function resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath, options) { | ||
const args = [resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath)]; | ||
var _a; | ||
const args = [resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath, (_a = options === null || options === void 0 ? void 0 : options.platform) !== null && _a !== void 0 ? _a : exports.systemDefaultPlatform)]; | ||
if (!(options === null || options === void 0 ? void 0 : options.reuseMachineInstall)) { | ||
@@ -170,0 +171,0 @@ args.push(...runTest_1.getProfileArguments(args)); |
{ | ||
"name": "@vscode/test-electron", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "compile": "tsc -p ./", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58117
953