@vscode/test-web 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +12 -9
- package/out/index.d.ts +12 -1
- package/out/index.js +27 -12
- package/out/server/main.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.17
|
|
4
|
+
* new options `--host` and `--port`: If provided runs the server from the given host and port.
|
|
5
|
+
* new option `--verbose` to print out the browser console log.
|
|
6
|
+
|
|
3
7
|
## 0.0.16
|
|
4
8
|
* new option `--sourcesPath`: If provided, runs the server from VS Code sources at the given location.
|
|
5
9
|
* option `--version` is deprecated and replaced with `quality`. Supported values: `stable`, `insiders`. Instead of `sources` use `--insiders`
|
package/README.md
CHANGED
|
@@ -65,19 +65,22 @@ go()
|
|
|
65
65
|
|
|
66
66
|
CLI options:
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
|Option|Argument Description|
|
|
69
|
+
|-----|-----|
|
|
70
|
+
| --browserType | The browser to launch: `chromium` (default), `firefox` or `webkit` |
|
|
71
71
|
| --extensionDevelopmentPath | A path pointing to an extension under development to include. |
|
|
72
|
-
| --extensionTestsPath |
|
|
72
|
+
| --extensionTestsPath | A path to a test module to run. |
|
|
73
73
|
| --quality | `insiders` (default), or `stable`. Ignored when sourcesPath is provided. |
|
|
74
|
-
| --sourcesPath | If set, runs from VS Code sources located at the given path. Make sure the sources and extensions are compiled (`yarn compile` and `yarn compile-web`) |
|
|
75
|
-
| --
|
|
76
|
-
| --
|
|
77
|
-
| --hideServerLog| If set, hides the server log. Defaults to true when an extensionTestsPath is provided, otherwise false. |
|
|
78
|
-
| --permission| Permission granted to the opened browser: e.g. `clipboard-read`, `clipboard-write`. See [full list of options](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions). Argument can be provided multiple times. |
|
|
74
|
+
| --sourcesPath | If set, runs the server from VS Code sources located at the given path. Make sure the sources and extensions are compiled (`yarn compile` and `yarn compile-web`) |
|
|
75
|
+
| --headless | If set, hides the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. |
|
|
76
|
+
| --permission | Permission granted to the opened browser: e.g. `clipboard-read`, `clipboard-write`. See [full list of options](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions). Argument can be provided multiple times. |
|
|
79
77
|
| --folder-uri | URI of the workspace to open VS Code on. Ignored when `folderPath` is provided |
|
|
80
78
|
| --extensionPath | A path pointing to a folder containing additional extensions to include. Argument can be provided multiple times. |
|
|
79
|
+
| --host | The host name the server is opened on. Defaults to `localhost` |
|
|
80
|
+
| --port | The port the server is opened on. Defaults to `3000` |
|
|
81
|
+
| --open-devtools | If set, opens the dev tools in the browser |
|
|
82
|
+
| --verbose | If set, prints out more information when running the server |
|
|
83
|
+
| --hideServerLog | If set, hides the server log. Defaults to true when an extensionTestsPath is provided, otherwise false. |
|
|
81
84
|
| folderPath | A local folder to open VS Code on. The folder content will be available as a virtual file system and opened as workspace. |
|
|
82
85
|
|
|
83
86
|
Corresponding options are available in the API.
|
package/out/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface Options {
|
|
|
35
35
|
*/
|
|
36
36
|
quality?: VSCodeQuality;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* @deprecated. Use `quality` or `vsCodeDevPath` instead.
|
|
39
39
|
*/
|
|
40
40
|
version?: string;
|
|
41
41
|
/**
|
|
@@ -79,7 +79,18 @@ export interface Options {
|
|
|
79
79
|
* Absolute path pointing to VS Code sources to use.
|
|
80
80
|
*/
|
|
81
81
|
vsCodeDevPath?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Print out more information while the server is running, e.g. the console output in the browser
|
|
84
|
+
*/
|
|
82
85
|
verbose?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The port to start the server on. Defaults to `3000`.
|
|
88
|
+
*/
|
|
89
|
+
port?: number;
|
|
90
|
+
/**
|
|
91
|
+
* The host name to start the server on. Defaults to `localhost`
|
|
92
|
+
*/
|
|
93
|
+
host?: string;
|
|
83
94
|
}
|
|
84
95
|
export interface Disposable {
|
|
85
96
|
dispose(): void;
|
package/out/index.js
CHANGED
|
@@ -18,19 +18,21 @@ const path = require("path");
|
|
|
18
18
|
* @param options The options defining browser type, extension and test location.
|
|
19
19
|
*/
|
|
20
20
|
async function runTests(options) {
|
|
21
|
+
var _a, _b, _c;
|
|
21
22
|
const config = {
|
|
22
23
|
extensionDevelopmentPath: options.extensionDevelopmentPath,
|
|
23
24
|
extensionTestsPath: options.extensionTestsPath,
|
|
24
25
|
build: await getBuild(options),
|
|
25
26
|
folderUri: options.folderUri,
|
|
26
27
|
folderMountPath: options.folderPath,
|
|
27
|
-
hideServerLog: true,
|
|
28
|
+
hideServerLog: (_a = options.hideServerLog) !== null && _a !== void 0 ? _a : true,
|
|
28
29
|
extensionPaths: options.extensionPaths
|
|
29
30
|
};
|
|
30
|
-
const
|
|
31
|
-
const
|
|
31
|
+
const host = (_b = options.host) !== null && _b !== void 0 ? _b : 'localhost';
|
|
32
|
+
const port = (_c = options.port) !== null && _c !== void 0 ? _c : 3000;
|
|
33
|
+
const server = await (0, main_1.runServer)(host, port, config);
|
|
32
34
|
return new Promise(async (s, e) => {
|
|
33
|
-
const endpoint = `http
|
|
35
|
+
const endpoint = `http://${host}:${port}`;
|
|
34
36
|
const context = await openBrowser(endpoint, options);
|
|
35
37
|
context.once('close', () => server.close());
|
|
36
38
|
await context.exposeFunction('codeAutomationLog', (type, args) => {
|
|
@@ -66,17 +68,20 @@ async function getBuild(options) {
|
|
|
66
68
|
return await (0, download_1.downloadAndUnzipVSCode)(quality === 'stable' ? 'stable' : 'insider');
|
|
67
69
|
}
|
|
68
70
|
async function open(options) {
|
|
71
|
+
var _a, _b, _c;
|
|
69
72
|
const config = {
|
|
70
73
|
extensionDevelopmentPath: options.extensionDevelopmentPath,
|
|
71
74
|
extensionTestsPath: options.extensionTestsPath,
|
|
72
75
|
build: await getBuild(options),
|
|
73
76
|
folderUri: options.folderUri,
|
|
74
77
|
folderMountPath: options.folderPath,
|
|
78
|
+
hideServerLog: (_a = options.hideServerLog) !== null && _a !== void 0 ? _a : true,
|
|
75
79
|
extensionPaths: options.extensionPaths
|
|
76
80
|
};
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
81
|
+
const host = (_b = options.host) !== null && _b !== void 0 ? _b : 'localhost';
|
|
82
|
+
const port = (_c = options.port) !== null && _c !== void 0 ? _c : 3000;
|
|
83
|
+
const server = await (0, main_1.runServer)(host, port, config);
|
|
84
|
+
const endpoint = `http://${host}:${port}`;
|
|
80
85
|
const context = await openBrowser(endpoint, options);
|
|
81
86
|
context.once('close', () => server.close());
|
|
82
87
|
return {
|
|
@@ -250,17 +255,21 @@ function validatePortNumber(port) {
|
|
|
250
255
|
}
|
|
251
256
|
function showHelp() {
|
|
252
257
|
console.log('Usage:');
|
|
253
|
-
console.log(` --browserType 'chromium' | 'firefox' | 'webkit': The browser to launch. [Optional,
|
|
258
|
+
console.log(` --browserType 'chromium' | 'firefox' | 'webkit': The browser to launch. [Optional, defaults to 'chromium']`);
|
|
254
259
|
console.log(` --extensionDevelopmentPath path: A path pointing to an extension under development to include. [Optional]`);
|
|
255
260
|
console.log(` --extensionTestsPath path: A path to a test module to run. [Optional]`);
|
|
256
261
|
console.log(` --quality 'insiders' | 'stable' [Optional, default 'insiders', ignored when running from sources]`);
|
|
257
262
|
console.log(` --sourcesPath path: If provided, running from VS Code sources at the given location [Optional]`);
|
|
258
263
|
console.log(` --open-devtools: If set, opens the dev tools [Optional]`);
|
|
259
264
|
console.log(` --headless: Whether to hide the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);
|
|
260
|
-
console.log(` --hideServerLog: Whether to hide the server log. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);
|
|
261
265
|
console.log(` --permission: Permission granted in the opened browser: e.g. 'clipboard-read', 'clipboard-write': [Optional, Multiple]`);
|
|
262
266
|
console.log(` --folder-uri: workspace to open VS Code on. Ignored when folderPath is provided [Optional]`);
|
|
263
267
|
console.log(` --extensionPath: A path pointing to a folder containing additional extensions to include [Optional, Multiple]`);
|
|
268
|
+
console.log(` --host: The host name the server is opened on [Optional, defaults to localhost]`);
|
|
269
|
+
console.log(` --port: The port the server is opened on [Optional, defaults to 3000]`);
|
|
270
|
+
console.log(` --open-devtools: If set, opens the dev tools [Optional]`);
|
|
271
|
+
console.log(` --verbose: If set, prints out more information when running the server [Optional]`);
|
|
272
|
+
console.log(` --hideServerLog: Whether to hide the server log. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);
|
|
264
273
|
console.log(` folderPath. A local folder to open VS Code on. The folder content will be available as a virtual file system. [Optional]`);
|
|
265
274
|
}
|
|
266
275
|
async function cliMain() {
|
|
@@ -268,7 +277,7 @@ async function cliMain() {
|
|
|
268
277
|
const manifest = require('../package.json');
|
|
269
278
|
console.log(`${manifest.name}: ${manifest.version}`);
|
|
270
279
|
const options = {
|
|
271
|
-
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'sourcesPath'],
|
|
280
|
+
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'sourcesPath', 'host', 'port'],
|
|
272
281
|
boolean: ['open-devtools', 'headless', 'hideServerLog', 'help', 'verbose'],
|
|
273
282
|
unknown: arg => {
|
|
274
283
|
if (arg.startsWith('-')) {
|
|
@@ -295,6 +304,8 @@ async function cliMain() {
|
|
|
295
304
|
const permissions = valdiatePermissions(args.permission);
|
|
296
305
|
const hideServerLog = validateBooleanOrUndefined(args, 'hideServerLog');
|
|
297
306
|
const verbose = validateBooleanOrUndefined(args, 'verbose');
|
|
307
|
+
const port = validatePortNumber(args.port);
|
|
308
|
+
const host = validateStringOrUndefined(args, 'host');
|
|
298
309
|
const waitForDebugger = validatePortNumber(args.waitForDebugger);
|
|
299
310
|
let folderUri = validateStringOrUndefined(args, 'folder-uri');
|
|
300
311
|
let folderPath;
|
|
@@ -324,7 +335,9 @@ async function cliMain() {
|
|
|
324
335
|
permissions,
|
|
325
336
|
extensionPaths,
|
|
326
337
|
vsCodeDevPath,
|
|
327
|
-
verbose
|
|
338
|
+
verbose,
|
|
339
|
+
host,
|
|
340
|
+
port
|
|
328
341
|
});
|
|
329
342
|
}
|
|
330
343
|
else {
|
|
@@ -341,7 +354,9 @@ async function cliMain() {
|
|
|
341
354
|
permissions,
|
|
342
355
|
extensionPaths,
|
|
343
356
|
vsCodeDevPath,
|
|
344
|
-
verbose
|
|
357
|
+
verbose,
|
|
358
|
+
host,
|
|
359
|
+
port
|
|
345
360
|
});
|
|
346
361
|
}
|
|
347
362
|
}
|
package/out/server/main.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.runServer = void 0;
|
|
8
8
|
const app_1 = require("./app");
|
|
9
|
-
async function runServer(port, config) {
|
|
9
|
+
async function runServer(host, port, config) {
|
|
10
10
|
const app = await (0, app_1.default)(config);
|
|
11
|
-
const server = app.listen(port);
|
|
12
|
-
console.log(`Listening on http
|
|
11
|
+
const server = app.listen(port, host);
|
|
12
|
+
console.log(`Listening on http://${host}:${port}`);
|
|
13
13
|
return server;
|
|
14
14
|
}
|
|
15
15
|
exports.runServer = runServer;
|