Socket
Socket
Sign inDemoInstall

@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.0 to 2.1.1

4

CHANGELOG.md
# Changelog
### 2.1.1 | 2021-01-20
- Fix excessive logging when running in CI
### 2.1.0 | 2021-01-14

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

4

out/download.d.ts

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

readonly reporter?: ProgressReporter;
readonly extractSync?: boolean;
}

@@ -42,3 +43,4 @@ export declare const defaultCachePath: string;

*/
export declare function downloadAndUnzipVSCode(version?: DownloadVersion, platform?: DownloadPlatform, reporter?: ProgressReporter): Promise<string>;
export declare function downloadAndUnzipVSCode(options: Partial<DownloadOptions>): Promise<string>;
export declare function downloadAndUnzipVSCode(version?: DownloadVersion, platform?: DownloadPlatform, reporter?: ProgressReporter, extractSync?: boolean): Promise<string>;
export {};

@@ -73,3 +73,4 @@ "use strict";

*/
async function unzipVSCode(extractDir, stream, format) {
async function unzipVSCode(reporter, extractDir, extractSync, stream, format) {
const stagingFile = path.join(os_1.tmpdir(), `vscode-test-${Date.now()}.zip`);
if (format === 'zip') {

@@ -83,3 +84,16 @@ // note: this used to use Expand-Archive, but this caused a failure

// - https://github.com/ZJONSSON/node-unzipper/issues/115 (not avoidable)
if (process.platform !== 'darwin') {
if (process.platform === 'win32' && extractSync) {
try {
await util_1.promisify(stream_1.pipeline)(stream, fs.createWriteStream(stagingFile));
reporter.report({ stage: progress_1.ProgressReportStage.ExtractingSynchonrously });
await spawnDecompressorChild('powershell.exe', [
'-NoProfile', '-ExecutionPolicy', 'Bypass', '-NonInteractive', '-NoLogo',
'-Command', `Microsoft.PowerShell.Archive\\Expand-Archive -Path "${stagingFile}" -DestinationPath "${extractDir}"`
]);
}
finally {
fs.unlink(stagingFile, () => undefined);
}
}
else if (process.platform !== 'darwin' && !extractSync) {
await new Promise((resolve, reject) => stream

@@ -90,10 +104,10 @@ .pipe(unzipper_1.Extract({ path: extractDir }))

}
else {
const stagingFile = path.join(os_1.tmpdir(), `vscode-test-${Date.now()}.zip`);
else { // darwin or *nix sync
try {
await util_1.promisify(stream_1.pipeline)(stream, fs.createWriteStream(stagingFile));
reporter.report({ stage: progress_1.ProgressReportStage.ExtractingSynchonrously });
await spawnDecompressorChild('unzip', ['-q', stagingFile, '-d', extractDir]);
}
finally {
// fs.unlink(stagingFile, () => undefined);
fs.unlink(stagingFile, () => undefined);
}

@@ -125,9 +139,5 @@ }

*/
async function download(options) {
var _a, _b, _c, _d;
async function download(options = {}) {
let version = options === null || options === void 0 ? void 0 : options.version;
const platform = (_a = options === null || options === void 0 ? void 0 : options.platform) !== null && _a !== void 0 ? _a : util_2.systemDefaultPlatform;
const architecture = (_b = options === null || options === void 0 ? void 0 : options.architecture) !== null && _b !== void 0 ? _b : util_2.systemDefaultArchitecture;
const cachePath = (_c = options === null || options === void 0 ? void 0 : options.cachePath) !== null && _c !== void 0 ? _c : exports.defaultCachePath;
const reporter = (_d = options === null || options === void 0 ? void 0 : options.reporter) !== null && _d !== void 0 ? _d : new progress_1.ConsoleReporter(process.stdout.isTTY);
const { platform = util_2.systemDefaultPlatform, architecture = util_2.systemDefaultArchitecture, cachePath = exports.defaultCachePath, reporter = new progress_1.ConsoleReporter(process.stdout.isTTY), extractSync = false, } = options;
if (version) {

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

const { stream, format } = await downloadVSCodeArchive({ version, architecture, platform, cachePath, reporter });
await unzipVSCode(downloadedPath, stream, format);
await unzipVSCode(reporter, downloadedPath, extractSync, stream, format);
reporter.report({ stage: progress_1.ProgressReportStage.NewInstallComplete, downloadedPath });

@@ -203,19 +213,7 @@ }

exports.download = download;
/**
* Download and unzip a copy of VS Code in `.vscode-test`. The paths are:
* - `.vscode-test/vscode-<PLATFORM>-<VERSION>`. For example, `./vscode-test/vscode-win32-1.32.0`
* - `.vscode-test/vscode-win32-insiders`.
*
* *If a local copy exists at `.vscode-test/vscode-<PLATFORM>-<VERSION>`, skip download.*
*
* @param version The version of VS Code to download such as `1.32.0`. You can also use
* `'stable'` for downloading latest stable release.
* `'insiders'` for downloading latest Insiders.
* When unspecified, download latest stable version.
*
* @returns Promise of `vscodeExecutablePath`.
*/
async function downloadAndUnzipVSCode(version, platform = util_2.systemDefaultPlatform, reporter) {
return await download({ version, platform, reporter });
async function downloadAndUnzipVSCode(versionOrOptions, platform, reporter, extractSync) {
return await download(typeof versionOrOptions === 'object'
? versionOrOptions
: { version: versionOrOptions, platform, reporter, extractSync });
}
exports.downloadAndUnzipVSCode = downloadAndUnzipVSCode;

@@ -17,2 +17,4 @@ /** Stages of progress while downloading VS Code */

Downloading = "downloading",
/** Fired when the command is issued to do a synchronous extraction. May not fire depending on the platform and options. */
ExtractingSynchonrously = "extractingSynchonrously",
/** Fired after folder is downloaded and unzipped */

@@ -47,2 +49,4 @@ NewInstallComplete = "newInstallComplete"

} | {
stage: ProgressReportStage.ExtractingSynchonrously;
} | {
stage: ProgressReportStage.NewInstallComplete;

@@ -49,0 +53,0 @@ downloadedPath: string;

@@ -25,2 +25,4 @@ "use strict";

ProgressReportStage["Downloading"] = "downloading";
/** Fired when the command is issued to do a synchronous extraction. May not fire depending on the platform and options. */
ProgressReportStage["ExtractingSynchonrously"] = "extractingSynchonrously";
/** Fired after folder is downloaded and unzipped */

@@ -64,3 +66,3 @@ ProgressReportStage["NewInstallComplete"] = "newInstallComplete";

case ProgressReportStage.Downloading:
if (!this.showDownloadProgress) {
if (!this.showDownloadProgress && report.bytesSoFar === 0) {
console.log(`Downloading VS Code (${report.totalBytes}B)`);

@@ -67,0 +69,0 @@ }

@@ -81,2 +81,7 @@ import { DownloadVersion, DownloadPlatform } from './download';

reporter?: ProgressReporter;
/**
* Whether the downloaded zip should be synchronously extracted. Should be
* omitted unless you're experiencing issues installing VS Code versions.
*/
extractSync?: boolean;
}

@@ -83,0 +88,0 @@ /**

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

if (!options.vscodeExecutablePath) {
options.vscodeExecutablePath = await download_1.downloadAndUnzipVSCode(options.version, options.platform, options.reporter);
options.vscodeExecutablePath = await download_1.downloadAndUnzipVSCode(options);
}

@@ -21,0 +21,0 @@ let args = [

{
"name": "@vscode/test-electron",
"version": "2.1.0",
"version": "2.1.1",
"scripts": {

@@ -5,0 +5,0 @@ "compile": "tsc -p ./",

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