Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vscode/test-electron

Package Overview
Dependencies
Maintainers
20
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/test-electron - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

out/download.test.d.ts

4

CHANGELOG.md
# Changelog
### 2.1.4 | 2022-06-10
- Fix uncaught error when failing to connect to the extension service
### 2.1.3 | 2022-03-04

@@ -4,0 +8,0 @@

8

out/download.d.ts

@@ -8,8 +8,3 @@ import { ProgressReporter } from './progress';

export declare type DownloadVersion = StringLiteralUnion<'insiders' | 'stable'>;
export declare type DownloadPlatform = StringLiteralUnion<'darwin' | 'win32-archive' | 'win32-x64-archive' | 'linux-x64'>;
export declare const enum DownloadArchitecture {
X64 = "x64",
X86 = "ia32",
ARM64 = "arm64"
}
export declare type DownloadPlatform = StringLiteralUnion<'darwin' | 'darwin-arm64' | 'win32-archive' | 'win32-x64-archive' | 'linux-x64' | 'linux-arm64' | 'linux-armhf'>;
export interface DownloadOptions {

@@ -19,3 +14,2 @@ readonly cachePath: string;

readonly platform: DownloadPlatform;
readonly architecture: DownloadArchitecture;
readonly reporter?: ProgressReporter;

@@ -22,0 +16,0 @@ readonly extractSync?: boolean;

@@ -44,3 +44,3 @@ "use strict";

}
const downloadUrl = util_2.getVSCodeDownloadUrl(options.version, options.platform, options.architecture);
const downloadUrl = util_2.getVSCodeDownloadUrl(options.version, options.platform);
(_a = options.reporter) === null || _a === void 0 ? void 0 : _a.report({ stage: progress_1.ProgressReportStage.ResolvingCDNLocation, url: downloadUrl });

@@ -121,3 +121,3 @@ const res = await request.getStream(downloadUrl);

}
await spawnDecompressorChild('tar', ['-xzf', '-', '-C', extractDir], stream);
await spawnDecompressorChild('tar', ['-xzf', '-', '--strip-components=1', '-C', extractDir], stream);
}

@@ -142,3 +142,3 @@ }

let version = options === null || options === void 0 ? void 0 : options.version;
const { platform = util_2.systemDefaultPlatform, architecture = util_2.systemDefaultArchitecture, cachePath = exports.defaultCachePath, reporter = new progress_1.ConsoleReporter(process.stdout.isTTY), extractSync = false, } = options;
const { platform = util_2.systemDefaultPlatform, cachePath = exports.defaultCachePath, reporter = new progress_1.ConsoleReporter(process.stdout.isTTY), extractSync = false, } = options;
if (version) {

@@ -197,3 +197,3 @@ if (version === 'stable') {

try {
const { stream, format } = await downloadVSCodeArchive({ version, architecture, platform, cachePath, reporter });
const { stream, format } = await downloadVSCodeArchive({ version, platform, cachePath, reporter });
await unzipVSCode(reporter, downloadedPath, extractSync, stream, format);

@@ -200,0 +200,0 @@ reporter.report({ stage: progress_1.ProgressReportStage.NewInstallComplete, downloadedPath });

@@ -36,8 +36,6 @@ "use strict";

});
res.on('error', err => {
reject(err);
});
});
res.on('error', reject);
}).on('error', reject);
});
}
exports.getJSON = getJSON;

@@ -23,8 +23,14 @@ import { DownloadVersion, DownloadPlatform } from './download';

/**
* The VS Code platform to download. If not specified, defaults to:
* - Windows: `win32-archive`
* - macOS: `darwin`
* - Linux: `linux-x64`
* The VS Code platform to download. If not specified, it defaults to the
* current platform.
*
* Possible values are: `win32-archive`, `win32-x64-archive`, `darwin` and `linux-x64`.
* Possible values are:
* - `win32-archive`
* - `win32-x64-archive`
* - `win32-arm64-archive `
* - `darwin`
* - `darwin-arm64`
* - `linux-x64`
* - `linux-arm64`
* - `linux-armhf`
*/

@@ -44,3 +50,3 @@ platform?: DownloadPlatform;

*/
extensionDevelopmentPath: string;
extensionDevelopmentPath: string | string[];
/**

@@ -47,0 +53,0 @@ * Absolute path to the extension tests runner. Passed to `--extensionTestsPath`.

@@ -28,5 +28,10 @@ "use strict";

'--disable-workspace-trust',
'--extensionDevelopmentPath=' + options.extensionDevelopmentPath,
'--extensionTestsPath=' + options.extensionTestsPath
];
if (Array.isArray(options.extensionDevelopmentPath)) {
args.push(...options.extensionDevelopmentPath.map(devPath => `--extensionDevelopmentPath=${devPath}`));
}
else {
args.push(`--extensionDevelopmentPath=${options.extensionDevelopmentPath}`);
}
if (options.launchArgs) {

@@ -33,0 +38,0 @@ args = options.launchArgs.concat(args);

/// <reference types="node" />
import * as https from 'https';
import { DownloadArchitecture, DownloadPlatform } from './download';
import { DownloadPlatform } from './download';
import { TestOptions } from './runTest';
export declare let systemDefaultPlatform: DownloadPlatform;
export declare const systemDefaultArchitecture: DownloadArchitecture;
export declare function getVSCodeDownloadUrl(version: string, platform?: DownloadPlatform, architecture?: DownloadArchitecture): string;
export declare function getVSCodeDownloadUrl(version: string, platform?: DownloadPlatform): string;
export declare function urlToOptions(url: string): https.RequestOptions;

@@ -9,0 +8,0 @@ export declare function downloadDirToExecutablePath(dir: string, platform: DownloadPlatform): string;

@@ -7,3 +7,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = exports.systemDefaultArchitecture = exports.systemDefaultPlatform = void 0;
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = exports.systemDefaultPlatform = void 0;
const path = require("path");

@@ -16,37 +16,27 @@ const url_1 = require("url");

const runTest_1 = require("./runTest");
const windowsPlatforms = new Set(['win32-archive', 'win32-x64-archive', 'win32-arm64-archive']);
const darwinPlatforms = new Set(['darwin-arm64', 'darwin']);
switch (process.platform) {
case 'darwin':
exports.systemDefaultPlatform = 'darwin';
exports.systemDefaultPlatform = process.arch === 'arm64' ? 'darwin-arm64' : 'darwin';
break;
case 'win32':
exports.systemDefaultPlatform = 'win32-archive';
exports.systemDefaultPlatform = process.arch === 'arm64'
? 'win32-arm64-archive'
: process.arch === 'ia32'
? 'win32-archive'
: 'win32-x64-archive';
break;
default:
exports.systemDefaultPlatform = 'linux-x64';
exports.systemDefaultPlatform = process.arch === 'arm64'
? 'linux-arm64'
: process.arch === 'arm'
? 'linux-armhf'
: 'linux-x64';
}
exports.systemDefaultArchitecture = process.arch === 'arm64'
? "arm64" /* ARM64 */
: process.arch === 'ia32'
? "ia32" /* X86 */
: "x64" /* X64 */;
function getVSCodeDownloadUrl(version, platform = exports.systemDefaultPlatform, architecture = exports.systemDefaultArchitecture) {
let downloadSegment;
switch (platform) {
case 'darwin':
downloadSegment = architecture === "arm64" /* ARM64 */ ? 'darwin-arm64' : 'darwin';
break;
case 'win32-archive':
downloadSegment = architecture === "arm64" /* ARM64 */ ? 'win32-arm64-archive' : 'win32-archive';
break;
case 'linux-x64':
downloadSegment = architecture === "arm64" /* ARM64 */ ? 'linux-arm64' : 'linux-x64';
break;
default:
downloadSegment = platform;
break;
}
function getVSCodeDownloadUrl(version, platform = exports.systemDefaultPlatform) {
if (version === 'insiders') {
return `https://update.code.visualstudio.com/latest/${downloadSegment}/insider`;
return `https://update.code.visualstudio.com/latest/${platform}/insider`;
}
return `https://update.code.visualstudio.com/${version}/${downloadSegment}/stable`;
return `https://update.code.visualstudio.com/${version}/${platform}/stable`;
}

@@ -76,10 +66,10 @@ exports.getVSCodeDownloadUrl = getVSCodeDownloadUrl;

function downloadDirToExecutablePath(dir, platform) {
if (platform === 'win32-archive' || platform === 'win32-x64-archive') {
if (windowsPlatforms.has(platform)) {
return path.resolve(dir, 'Code.exe');
}
else if (platform === 'darwin') {
else if (darwinPlatforms.has(platform)) {
return path.resolve(dir, 'Visual Studio Code.app/Contents/MacOS/Electron');
}
else {
return path.resolve(dir, 'VSCode-linux-x64/code');
return path.resolve(dir, 'code');
}

@@ -89,10 +79,10 @@ }

function insidersDownloadDirToExecutablePath(dir, platform) {
if (platform === 'win32-archive' || platform === 'win32-x64-archive') {
if (windowsPlatforms.has(platform)) {
return path.resolve(dir, 'Code - Insiders.exe');
}
else if (platform === 'darwin') {
else if (darwinPlatforms.has(platform)) {
return path.resolve(dir, 'Visual Studio Code - Insiders.app/Contents/MacOS/Electron');
}
else {
return path.resolve(dir, 'VSCode-linux-x64/code-insiders');
return path.resolve(dir, 'code-insiders');
}

@@ -103,10 +93,10 @@ }

let productJsonPath;
if (platform === 'win32-archive' || platform === 'win32-x64-archive') {
if (windowsPlatforms.has(platform)) {
productJsonPath = path.resolve(dir, 'resources/app/product.json');
}
else if (platform === 'darwin') {
else if (darwinPlatforms.has(platform)) {
productJsonPath = path.resolve(dir, 'Visual Studio Code - Insiders.app/Contents/Resources/app/product.json');
}
else {
productJsonPath = path.resolve(dir, 'VSCode-linux-x64/resources/app/product.json');
productJsonPath = path.resolve(dir, 'resources/app/product.json');
}

@@ -130,3 +120,3 @@ const productJson = JSON.parse(fs_1.readFileSync(productJsonPath, 'utf-8'));

function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath, platform) {
if (platform === 'win32-archive' || platform === 'win32-x64-archive') {
if (windowsPlatforms.has(platform)) {
if (vscodeExecutablePath.endsWith('Code - Insiders.exe')) {

@@ -139,3 +129,3 @@ return path.resolve(vscodeExecutablePath, '../bin/code-insiders.cmd');

}
else if (platform === 'darwin') {
else if (darwinPlatforms.has(platform)) {
return path.resolve(vscodeExecutablePath, '../../../Contents/Resources/app/bin/code');

@@ -142,0 +132,0 @@ }

{
"name": "@vscode/test-electron",
"version": "2.1.3",
"version": "2.1.4",
"scripts": {

@@ -8,3 +8,3 @@ "compile": "tsc -p ./",

"prepublish": "tsc -p ./",
"test": "eslint lib --ext ts && tsc --noEmit"
"test": "eslint lib --ext ts && vitest && tsc --noEmit"
},

@@ -29,3 +29,4 @@ "main": "./out/index.js",

"eslint-plugin-header": "^3.1.0",
"typescript": "^4.3.5"
"typescript": "^4.3.5",
"vitest": "^0.10.2"
},

@@ -32,0 +33,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc