Socket
Socket
Sign inDemoInstall

@vscode/test-electron

Package Overview
Dependencies
Maintainers
19
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.0.1 to 2.0.2

4

CHANGELOG.md
# Changelog
### 2.0.2 | 2021-12-29
- Add `resolveCliArgsFromVSCodeExecutablePath`
### 2.0.1 | 2021-12-29

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

2

out/index.d.ts
export { download, downloadAndUnzipVSCode } from './download';
export { runTests } from './runTest';
export { resolveCliPathFromVSCodeExecutablePath } from './util';
export { resolveCliPathFromVSCodeExecutablePath, resolveCliArgsFromVSCodeExecutablePath } from './util';

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveCliPathFromVSCodeExecutablePath = exports.runTests = exports.downloadAndUnzipVSCode = exports.download = void 0;
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.runTests = exports.downloadAndUnzipVSCode = exports.download = void 0;
var download_1 = require("./download");

@@ -16,1 +16,2 @@ Object.defineProperty(exports, "download", { enumerable: true, get: function () { return download_1.download; } });

Object.defineProperty(exports, "resolveCliPathFromVSCodeExecutablePath", { enumerable: true, get: function () { return util_1.resolveCliPathFromVSCodeExecutablePath; } });
Object.defineProperty(exports, "resolveCliArgsFromVSCodeExecutablePath", { enumerable: true, get: function () { return util_1.resolveCliArgsFromVSCodeExecutablePath; } });

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

export declare function runTests(options: TestOptions): Promise<number>;
/** Adds the extensions and user data dir to the arguments for the VS Code CLI */
export declare function getProfileArguments(args: readonly string[]): string[];

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.runTests = void 0;
exports.getProfileArguments = exports.runTests = void 0;
const cp = require("child_process");

@@ -34,8 +34,3 @@ const path = require("path");

if (!options.reuseMachineInstall) {
if (!hasArg('extensions-dir', args)) {
args.push(`--extensions-dir=${path.join(download_1.defaultCachePath, 'extensions')}`);
}
if (!hasArg('user-data-dir', args)) {
args.push(`--user-data-dir=${path.join(download_1.defaultCachePath, 'user-data')}`);
}
args.push(...getProfileArguments(args));
}

@@ -45,2 +40,14 @@ return innerRunTests(options.vscodeExecutablePath, args, options.extensionTestsEnv);

exports.runTests = runTests;
/** Adds the extensions and user data dir to the arguments for the VS Code CLI */
function getProfileArguments(args) {
const out = [];
if (!hasArg('extensions-dir', args)) {
out.push(`--extensions-dir=${path.join(download_1.defaultCachePath, 'extensions')}`);
}
if (!hasArg('user-data-dir', args)) {
out.push(`--user-data-dir=${path.join(download_1.defaultCachePath, 'user-data')}`);
}
return out;
}
exports.getProfileArguments = getProfileArguments;
function hasArg(argName, argList) {

@@ -47,0 +54,0 @@ return argList.some(a => a === `--${argName}` || a.startsWith(`--${argName}=`));

/// <reference types="node" />
import * as https from 'https';
import { DownloadPlatform } from './download';
import { TestOptions } from './runTest';
export declare let systemDefaultPlatform: string;

@@ -26,2 +27,7 @@ export declare function getVSCodeDownloadUrl(version: string, platform?: DownloadPlatform): string;

* Resolve the VS Code cli path from executable path returned from `downloadAndUnzipVSCode`.
* Usually you will want {@link resolveCliArgsFromVSCodeExecutablePath} instead.
*/
export declare function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath: string): string;
/**
* Resolve the VS Code cli arguments from executable path returned from `downloadAndUnzipVSCode`.
* You can use this path to spawn processes for extension management. For example:

@@ -31,7 +37,7 @@ *

* const cp = require('child_process');
* const { downloadAndUnzipVSCode, resolveCliPathFromExecutablePath } = require('@vscode/test-electron')
* const { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath } = require('@vscode/test-electron')
* const vscodeExecutablePath = await downloadAndUnzipVSCode('1.36.0');
* const cliPath = resolveCliPathFromExecutablePath(vscodeExecutablePath);
* const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
*
* cp.spawnSync(cliPath, ['--install-extension', '<EXTENSION-ID-OR-PATH-TO-VSIX>'], {
* cp.spawnSync(cli, [...args, '--install-extension', '<EXTENSION-ID-OR-PATH-TO-VSIX>'], {
* encoding: 'utf-8',

@@ -44,2 +50,2 @@ * stdio: 'inherit'

*/
export declare function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath: string): string;
export declare function resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath: string, options?: Pick<TestOptions, 'reuseMachineInstall'>): string[];

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = 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");

@@ -15,2 +15,3 @@ const url_1 = require("url");

const fs_1 = require("fs");
const runTest_1 = require("./runTest");
switch (process.platform) {

@@ -104,17 +105,3 @@ case 'darwin':

* Resolve the VS Code cli path from executable path returned from `downloadAndUnzipVSCode`.
* You can use this path to spawn processes for extension management. For example:
*
* ```ts
* const cp = require('child_process');
* const { downloadAndUnzipVSCode, resolveCliPathFromExecutablePath } = require('@vscode/test-electron')
* const vscodeExecutablePath = await downloadAndUnzipVSCode('1.36.0');
* const cliPath = resolveCliPathFromExecutablePath(vscodeExecutablePath);
*
* cp.spawnSync(cliPath, ['--install-extension', '<EXTENSION-ID-OR-PATH-TO-VSIX>'], {
* encoding: 'utf-8',
* stdio: 'inherit'
* });
* ```
*
* @param vscodeExecutablePath The `vscodeExecutablePath` from `downloadAndUnzipVSCode`.
* Usually you will want {@link resolveCliArgsFromVSCodeExecutablePath} instead.
*/

@@ -143,1 +130,27 @@ function resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath) {

exports.resolveCliPathFromVSCodeExecutablePath = resolveCliPathFromVSCodeExecutablePath;
/**
* Resolve the VS Code cli arguments from executable path returned from `downloadAndUnzipVSCode`.
* You can use this path to spawn processes for extension management. For example:
*
* ```ts
* const cp = require('child_process');
* const { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath } = require('@vscode/test-electron')
* const vscodeExecutablePath = await downloadAndUnzipVSCode('1.36.0');
* const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
*
* cp.spawnSync(cli, [...args, '--install-extension', '<EXTENSION-ID-OR-PATH-TO-VSIX>'], {
* encoding: 'utf-8',
* stdio: 'inherit'
* });
* ```
*
* @param vscodeExecutablePath The `vscodeExecutablePath` from `downloadAndUnzipVSCode`.
*/
function resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath, options) {
const args = [resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath)];
if (!(options === null || options === void 0 ? void 0 : options.reuseMachineInstall)) {
args.push(...runTest_1.getProfileArguments(args));
}
return args;
}
exports.resolveCliArgsFromVSCodeExecutablePath = resolveCliArgsFromVSCodeExecutablePath;
{
"name": "@vscode/test-electron",
"version": "2.0.1",
"version": "2.0.2",
"scripts": {

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

@@ -85,7 +85,7 @@ # vscode-test

*/
const cliPath = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath)
cp.spawnSync(cliPath, ['--install-extension', 'ms-python.python'], {
const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
cp.spawnSync(cli, [...args, '--install-extension', 'ms-python.python'], {
encoding: 'utf-8',
stdio: 'inherit'
})
});

@@ -92,0 +92,0 @@ /**

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