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

@vscode/test-web

Package Overview
Dependencies
Maintainers
19
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/test-web - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

3

CHANGELOG.md
# Changelog
## 0.0.18
* new option `--browserType none` to start the server without opening a browser.
## 0.0.17

@@ -4,0 +7,0 @@ * new options `--host` and `--port`: If provided runs the server from the given host and port.

8

fs-provider/dist/extension-web.js

@@ -8,3 +8,3 @@ /******/ (() => { // webpackBootstrap

"use strict";
module.exports = require("vscode");;
module.exports = require("vscode");

@@ -46,3 +46,3 @@ /***/ }),

const url = entry.serverUri.with({ query: 'stat' }).toString();
const response = await request_light_1.xhr({ url: url.toString() });
const response = await (0, request_light_1.xhr)({ url });
if (response.status === 200) {

@@ -72,3 +72,3 @@ try {

const url = entry.serverUri.with({ query: 'readdir' }).toString();
const response = await request_light_1.xhr({ url });
const response = await (0, request_light_1.xhr)({ url });
if (response.status === 200) {

@@ -123,3 +123,3 @@ try {

if (serverUri) {
const response = await request_light_1.xhr({ url: serverUri.toString() });
const response = await (0, request_light_1.xhr)({ url: serverUri.toString() });
if (response.status >= 200 && response.status <= 204) {

@@ -126,0 +126,0 @@ content = entry.content = response.body;

@@ -14,3 +14,3 @@ /******/ (() => { // webpackBootstrap

"use strict";
module.exports = require("vscode");;
module.exports = require("vscode");

@@ -545,3 +545,3 @@ /***/ }),

const url = serverUri.with({ query: 'readdir' }).toString();
const response = await request_light_1.xhr({ url });
const response = await (0, request_light_1.xhr)({ url });
if (response.status === 200 && response.status <= 204) {

@@ -574,3 +574,3 @@ try {

const url = serverUri.with({ query: 'stat' }).toString();
const response = await request_light_1.xhr({ url });
const response = await (0, request_light_1.xhr)({ url });
if (response.status === 200 && response.status <= 204) {

@@ -586,3 +586,3 @@ const res = JSON.parse(response.responseText);

async function getContent(serverUri) {
const response = await request_light_1.xhr({ url: serverUri.toString() });
const response = await (0, request_light_1.xhr)({ url: serverUri.toString() });
if (response.status >= 200 && response.status <= 204) {

@@ -589,0 +589,0 @@ return response.body;

#!/usr/bin/env node
export declare type BrowserType = 'chromium' | 'firefox' | 'webkit';
export declare type BrowserType = 'chromium' | 'firefox' | 'webkit' | 'none';
export declare type VSCodeQuality = 'insiders' | 'stable';
export interface Options {
/**
* Browser to run the test against: 'chromium' | 'firefox' | 'webkit'
* Browser to open: 'chromium' | 'firefox' | 'webkit' | 'none'.
*/

@@ -8,0 +8,0 @@ browserType: BrowserType;

@@ -37,22 +37,28 @@ #!/usr/bin/env node

const context = await openBrowser(endpoint, options);
context.once('close', () => server.close());
await context.exposeFunction('codeAutomationLog', (type, args) => {
console[type](...args);
});
await context.exposeFunction('codeAutomationExit', async (code) => {
var _a;
try {
await ((_a = context.browser()) === null || _a === void 0 ? void 0 : _a.close());
}
catch (error) {
console.error(`Error when closing browser: ${error}`);
}
if (context) {
context.once('close', () => server.close());
await context.exposeFunction('codeAutomationLog', (type, args) => {
console[type](...args);
});
await context.exposeFunction('codeAutomationExit', async (code) => {
var _a;
try {
await ((_a = context.browser()) === null || _a === void 0 ? void 0 : _a.close());
}
catch (error) {
console.error(`Error when closing browser: ${error}`);
}
server.close();
if (code === 0) {
s();
}
else {
e(new Error('Test failed'));
}
});
}
else {
server.close();
if (code === 0) {
s();
}
else {
e(new Error('Test failed'));
}
});
e(new Error('Can not run test as opening of browser failed.'));
}
});

@@ -87,3 +93,3 @@ }

const context = await openBrowser(endpoint, options);
context.once('close', () => server.close());
context === null || context === void 0 ? void 0 : context.once('close', () => server.close());
return {

@@ -93,3 +99,3 @@ dispose: () => {

server.close();
(_a = context.browser()) === null || _a === void 0 ? void 0 : _a.close();
(_a = context === null || context === void 0 ? void 0 : context.browser()) === null || _a === void 0 ? void 0 : _a.close();
}

@@ -103,2 +109,10 @@ };

var _a, _b;
if (options.browserType === 'none') {
return undefined;
}
const browserType = await playwright[options.browserType];
if (!browserType) {
console.error(`Can not open browser type: ${options.browserType}`);
return undefined;
}
const args = [];

@@ -112,3 +126,3 @@ if (process.platform === 'linux' && options.browserType === 'chromium') {

const headless = (_a = options.headless) !== null && _a !== void 0 ? _a : options.extensionTestsPath !== undefined;
const browser = await playwright[options.browserType].launch({ headless, args, devtools: options.devTools });
const browser = await browserType.launch({ headless, args, devtools: options.devTools });
const context = await browser.newContext();

@@ -168,3 +182,3 @@ if (options.permissions) {

}
if ((typeof browserType === 'string') && ['chromium', 'firefox', 'webkit'].includes(browserType)) {
if ((typeof browserType === 'string') && ['chromium', 'firefox', 'webkit', 'none'].includes(browserType)) {
return browserType;

@@ -264,3 +278,3 @@ }

console.log('Usage:');
console.log(` --browserType 'chromium' | 'firefox' | 'webkit': The browser to launch. [Optional, defaults to 'chromium']`);
console.log(` --browserType 'chromium' | 'firefox' | 'webkit' | 'none': The browser to launch. [Optional, defaults to 'chromium']`);
console.log(` --extensionDevelopmentPath path: A path pointing to an extension under development to include. [Optional]`);

@@ -348,2 +362,5 @@ console.log(` --extensionTestsPath path: A path to a test module to run. [Optional]`);

port
}).catch(e => {
console.log(e.message);
process.exit(1);
});

@@ -350,0 +367,0 @@ }

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

{
"name": "@vscode/test-web",
"version": "0.0.17",
"version": "0.0.18",
"scripts": {

@@ -14,4 +14,4 @@ "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",

"compile-sample": "yarn --cwd=sample compile-web",
"sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --browserType=chromium --verbose sample/test-workspace",
"sample-tests": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --extensionTestsPath=sample/dist/web/test/suite/index.js --browserType=chromium --headless=false sample/test-workspace"
"sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --verbose sample/test-workspace",
"sample-tests": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --extensionTestsPath=sample/dist/web/test/suite/index.js --headless=false sample/test-workspace"
},

@@ -18,0 +18,0 @@ "main": "./out/index.js",

@@ -70,3 +70,3 @@ # @vscode/test-web

|-----|-----|
| --browserType | The browser to launch: `chromium` (default), `firefox` or `webkit` |
| --browserType | The browser to launch: `chromium` (default), `firefox`, `webkit` or `none` |
| --extensionDevelopmentPath | A path pointing to an extension under development to include. |

@@ -73,0 +73,0 @@ | --extensionTestsPath | A path to a test module to run. |

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