@vscode/test-web 0.0.21 → 0.0.22
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 +5 -0
- package/README.md +10 -10
- package/out/index.d.ts +5 -1
- package/out/index.js +36 -24
- package/out/server/app.js +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -67,21 +67,21 @@ CLI options:
|
|
|
67
67
|
|
|
68
68
|
|Option|Argument Description|
|
|
69
69
|
|-----|-----|
|
|
70
|
-
| --
|
|
70
|
+
| --browser | The browser to launch: `chromium` (default), `firefox`, `webkit` or `none`. |
|
|
71
71
|
| --extensionDevelopmentPath | A path pointing to an extension under development to include. |
|
|
72
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 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`) |
|
|
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
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.
|
|
77
|
-
| --folder-uri | URI of the workspace to open VS Code on. Ignored when `folderPath` is provided |
|
|
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. |
|
|
77
|
+
| --folder-uri | URI of the workspace to open VS Code on. Ignored when `folderPath` is provided. |
|
|
78
78
|
| --extensionPath | A path pointing to a folder containing additional extensions to include. Argument can be provided multiple times. |
|
|
79
|
-
| --extensionId | The id of an extension include. The format is `${publisher}.${name}`. Append `@prerelease` to use the prerelease version |
|
|
80
|
-
| --host | The host name the server is opened on. Defaults to `localhost
|
|
81
|
-
| --port | The port the server is opened on. Defaults to `3000
|
|
82
|
-
| --open-devtools | If set, opens the dev tools in the browser |
|
|
83
|
-
| --verbose | If set, prints out more information when running the server |
|
|
84
|
-
| --
|
|
79
|
+
| --extensionId | The id of an extension include. The format is `${publisher}.${name}`. Append `@prerelease` to use the prerelease version. |
|
|
80
|
+
| --host | The host name the server is opened on. Defaults to `localhost`. |
|
|
81
|
+
| --port | The port the server is opened on. Defaults to `3000`. |
|
|
82
|
+
| --open-devtools | If set, opens the dev tools in the browser. |
|
|
83
|
+
| --verbose | If set, prints out more information when running the server. |
|
|
84
|
+
| --printServerLog | If set, prints the server access log. |
|
|
85
85
|
| folderPath | A local folder to open VS Code on. The folder content will be available as a virtual file system and opened as workspace. |
|
|
86
86
|
|
|
87
87
|
Corresponding options are available in the API.
|
package/out/index.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ export interface Options {
|
|
|
51
51
|
*/
|
|
52
52
|
headless?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* @deprecated. Use `printServerLog` instead.
|
|
55
55
|
*/
|
|
56
56
|
hideServerLog?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If set, the server access log is printed to the console. Defaults to `false`.
|
|
59
|
+
*/
|
|
60
|
+
printServerLog?: boolean;
|
|
57
61
|
/**
|
|
58
62
|
* Expose browser debugging on this port number, and wait for the debugger to attach before running tests.
|
|
59
63
|
*/
|
package/out/index.js
CHANGED
|
@@ -25,7 +25,7 @@ async function runTests(options) {
|
|
|
25
25
|
build: await getBuild(options),
|
|
26
26
|
folderUri: options.folderUri,
|
|
27
27
|
folderMountPath: options.folderPath,
|
|
28
|
-
|
|
28
|
+
printServerLog: (_a = options.printServerLog) !== null && _a !== void 0 ? _a : options.hideServerLog === false,
|
|
29
29
|
extensionPaths: options.extensionPaths,
|
|
30
30
|
extensionIds: options.extensionIds
|
|
31
31
|
};
|
|
@@ -82,7 +82,7 @@ async function open(options) {
|
|
|
82
82
|
build: await getBuild(options),
|
|
83
83
|
folderUri: options.folderUri,
|
|
84
84
|
folderMountPath: options.folderPath,
|
|
85
|
-
|
|
85
|
+
printServerLog: (_a = options.printServerLog) !== null && _a !== void 0 ? _a : options.hideServerLog === false,
|
|
86
86
|
extensionPaths: options.extensionPaths,
|
|
87
87
|
extensionIds: options.extensionIds
|
|
88
88
|
};
|
|
@@ -101,8 +101,6 @@ async function open(options) {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
exports.open = open;
|
|
104
|
-
const width = 1200;
|
|
105
|
-
const height = 800;
|
|
106
104
|
async function openBrowser(endpoint, options) {
|
|
107
105
|
var _a, _b;
|
|
108
106
|
if (options.browserType === 'none') {
|
|
@@ -122,7 +120,7 @@ async function openBrowser(endpoint, options) {
|
|
|
122
120
|
}
|
|
123
121
|
const headless = (_a = options.headless) !== null && _a !== void 0 ? _a : options.extensionTestsPath !== undefined;
|
|
124
122
|
const browser = await browserType.launch({ headless, args, devtools: options.devTools });
|
|
125
|
-
const context = await browser.newContext();
|
|
123
|
+
const context = await browser.newContext({ viewport: null });
|
|
126
124
|
if (options.permissions) {
|
|
127
125
|
context.grantPermissions(options.permissions);
|
|
128
126
|
}
|
|
@@ -146,7 +144,6 @@ async function openBrowser(endpoint, options) {
|
|
|
146
144
|
console.log(message.text());
|
|
147
145
|
});
|
|
148
146
|
}
|
|
149
|
-
await page.setViewportSize({ width, height });
|
|
150
147
|
await page.goto(endpoint);
|
|
151
148
|
return context;
|
|
152
149
|
}
|
|
@@ -172,14 +169,29 @@ function validateBooleanOrUndefined(options, name) {
|
|
|
172
169
|
showHelp();
|
|
173
170
|
process.exit(-1);
|
|
174
171
|
}
|
|
175
|
-
function
|
|
172
|
+
function validatePrintServerLog(options) {
|
|
173
|
+
const printServerLog = validateBooleanOrUndefined(options, 'printServerLog');
|
|
174
|
+
if (printServerLog !== undefined) {
|
|
175
|
+
return printServerLog;
|
|
176
|
+
}
|
|
177
|
+
const hideServerLog = validateBooleanOrUndefined(options, 'hideServerLog');
|
|
178
|
+
if (hideServerLog !== undefined) {
|
|
179
|
+
return !hideServerLog;
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
function valdiateBrowserType(options) {
|
|
184
|
+
const browserType = options.browser || options.browserType;
|
|
176
185
|
if (browserType === undefined) {
|
|
177
186
|
return 'chromium';
|
|
178
187
|
}
|
|
188
|
+
if (options.browserType && options.browser) {
|
|
189
|
+
console.log(`Ignoring browserType option '${options.browserType}' as browser option '${options.browser}' is set.`);
|
|
190
|
+
}
|
|
179
191
|
if ((typeof browserType === 'string') && ['chromium', 'firefox', 'webkit', 'none'].includes(browserType)) {
|
|
180
192
|
return browserType;
|
|
181
193
|
}
|
|
182
|
-
console.log(`Invalid browser
|
|
194
|
+
console.log(`Invalid browser option ${browserType}.`);
|
|
183
195
|
showHelp();
|
|
184
196
|
process.exit(-1);
|
|
185
197
|
}
|
|
@@ -304,22 +316,22 @@ function validatePortNumber(port) {
|
|
|
304
316
|
}
|
|
305
317
|
function showHelp() {
|
|
306
318
|
console.log('Usage:');
|
|
307
|
-
console.log(` --
|
|
319
|
+
console.log(` --browser 'chromium' | 'firefox' | 'webkit' | 'none': The browser to launch. [Optional, defaults to 'chromium']`);
|
|
308
320
|
console.log(` --extensionDevelopmentPath path: A path pointing to an extension under development to include. [Optional]`);
|
|
309
321
|
console.log(` --extensionTestsPath path: A path to a test module to run. [Optional]`);
|
|
310
322
|
console.log(` --quality 'insiders' | 'stable' [Optional, default 'insiders', ignored when running from sources]`);
|
|
311
|
-
console.log(` --sourcesPath path: If provided, running from VS Code sources at the given location [Optional]`);
|
|
312
|
-
console.log(` --open-devtools: If set, opens the dev tools
|
|
323
|
+
console.log(` --sourcesPath path: If provided, running from VS Code sources at the given location. [Optional]`);
|
|
324
|
+
console.log(` --open-devtools: If set, opens the dev tools. [Optional]`);
|
|
313
325
|
console.log(` --headless: Whether to hide the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);
|
|
314
|
-
console.log(` --permission: Permission granted in the opened browser: e.g. 'clipboard-read', 'clipboard-write'
|
|
315
|
-
console.log(` --folder-uri: workspace to open VS Code on. Ignored when folderPath is provided [Optional]`);
|
|
326
|
+
console.log(` --permission: Permission granted in the opened browser: e.g. 'clipboard-read', 'clipboard-write'. [Optional, Multiple]`);
|
|
327
|
+
console.log(` --folder-uri: workspace to open VS Code on. Ignored when folderPath is provided. [Optional]`);
|
|
316
328
|
console.log(` --extensionPath: A path pointing to a folder containing additional extensions to include [Optional, Multiple]`);
|
|
317
329
|
console.log(` --extensionId: The id of an extension include. The format is '\${publisher}.\${name}'. Append '@prerelease' to use a prerelease version [Optional, Multiple]`);
|
|
318
|
-
console.log(` --host: The host name the server is opened on
|
|
319
|
-
console.log(` --port: The port the server is opened on
|
|
320
|
-
console.log(` --open-devtools: If set, opens the dev tools
|
|
321
|
-
console.log(` --verbose: If set, prints out more information when running the server
|
|
322
|
-
console.log(` --
|
|
330
|
+
console.log(` --host: The host name the server is opened on. [Optional, defaults to localhost]`);
|
|
331
|
+
console.log(` --port: The port the server is opened on. [Optional, defaults to 3000]`);
|
|
332
|
+
console.log(` --open-devtools: If set, opens the dev tools. [Optional]`);
|
|
333
|
+
console.log(` --verbose: If set, prints out more information when running the server. [Optional]`);
|
|
334
|
+
console.log(` --printServerLog: If set, prints the server access log. [Optional]`);
|
|
323
335
|
console.log(` folderPath. A local folder to open VS Code on. The folder content will be available as a virtual file system. [Optional]`);
|
|
324
336
|
}
|
|
325
337
|
async function cliMain() {
|
|
@@ -327,8 +339,8 @@ async function cliMain() {
|
|
|
327
339
|
const manifest = require('../package.json');
|
|
328
340
|
console.log(`${manifest.name}: ${manifest.version}`);
|
|
329
341
|
const options = {
|
|
330
|
-
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port'],
|
|
331
|
-
boolean: ['open-devtools', 'headless', 'hideServerLog', 'help', 'verbose'],
|
|
342
|
+
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browser', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port'],
|
|
343
|
+
boolean: ['open-devtools', 'headless', 'hideServerLog', 'printServerLog', 'help', 'verbose'],
|
|
332
344
|
unknown: arg => {
|
|
333
345
|
if (arg.startsWith('-')) {
|
|
334
346
|
console.log(`Unknown argument ${arg}`);
|
|
@@ -343,7 +355,7 @@ async function cliMain() {
|
|
|
343
355
|
showHelp();
|
|
344
356
|
process.exit();
|
|
345
357
|
}
|
|
346
|
-
const browserType = valdiateBrowserType(args
|
|
358
|
+
const browserType = valdiateBrowserType(args);
|
|
347
359
|
const extensionTestsPath = await validatePathOrUndefined(args, 'extensionTestsPath', true);
|
|
348
360
|
const extensionDevelopmentPath = await validatePathOrUndefined(args, 'extensionDevelopmentPath');
|
|
349
361
|
const extensionPaths = await valdiateExtensionPaths(args.extensionPath);
|
|
@@ -353,7 +365,7 @@ async function cliMain() {
|
|
|
353
365
|
const devTools = validateBooleanOrUndefined(args, 'open-devtools');
|
|
354
366
|
const headless = validateBooleanOrUndefined(args, 'headless');
|
|
355
367
|
const permissions = valdiatePermissions(args.permission);
|
|
356
|
-
const
|
|
368
|
+
const printServerLog = validatePrintServerLog(args);
|
|
357
369
|
const verbose = validateBooleanOrUndefined(args, 'verbose');
|
|
358
370
|
const port = validatePortNumber(args.port);
|
|
359
371
|
const host = validateStringOrUndefined(args, 'host');
|
|
@@ -382,7 +394,7 @@ async function cliMain() {
|
|
|
382
394
|
folderUri,
|
|
383
395
|
folderPath,
|
|
384
396
|
headless,
|
|
385
|
-
|
|
397
|
+
printServerLog: printServerLog,
|
|
386
398
|
permissions,
|
|
387
399
|
extensionPaths,
|
|
388
400
|
extensionIds,
|
|
@@ -405,7 +417,7 @@ async function cliMain() {
|
|
|
405
417
|
folderUri,
|
|
406
418
|
folderPath,
|
|
407
419
|
headless,
|
|
408
|
-
|
|
420
|
+
printServerLog: printServerLog,
|
|
409
421
|
permissions,
|
|
410
422
|
extensionPaths,
|
|
411
423
|
extensionIds,
|
package/out/server/app.js
CHANGED
|
@@ -14,7 +14,7 @@ const mounts_1 = require("./mounts");
|
|
|
14
14
|
const extensions_1 = require("./extensions");
|
|
15
15
|
async function createApp(config) {
|
|
16
16
|
const app = new Koa();
|
|
17
|
-
if (
|
|
17
|
+
if (config.printServerLog) {
|
|
18
18
|
app.use(morgan('dev'));
|
|
19
19
|
}
|
|
20
20
|
// this is here such that the iframe worker can fetch the extension files
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/test-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",
|
|
6
6
|
"compile": "tsc -p ./ && yarn compile-fs-provider",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"compile-fs-provider": "yarn --cwd=fs-provider compile-web",
|
|
13
13
|
"compile-sample": "yarn --cwd=sample compile-web",
|
|
14
14
|
"sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample sample/test-workspace",
|
|
15
|
-
"sample-tests": "npm run compile &&
|
|
15
|
+
"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"
|
|
16
16
|
},
|
|
17
17
|
"main": "./out/index.js",
|
|
18
18
|
"bin": {
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@koa/router": "^10.1.1",
|
|
26
|
-
"koa": "^2.13.
|
|
26
|
+
"koa": "^2.13.4",
|
|
27
27
|
"koa-morgan": "^1.0.1",
|
|
28
28
|
"koa-mount": "^4.0.0",
|
|
29
29
|
"koa-static": "^5.0.0",
|
|
30
30
|
"minimist": "^1.2.5",
|
|
31
|
-
"playwright": "1.
|
|
32
|
-
"vscode-uri": "^3.0.
|
|
33
|
-
"http-proxy-agent": "^
|
|
31
|
+
"playwright": "^1.18.1",
|
|
32
|
+
"vscode-uri": "^3.0.3",
|
|
33
|
+
"http-proxy-agent": "^5.0.0",
|
|
34
34
|
"https-proxy-agent": "^5.0.0",
|
|
35
35
|
"decompress": "^4.2.1",
|
|
36
36
|
"decompress-targz": "^4.1.1"
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"@types/koa-morgan": "^1.0.5",
|
|
41
41
|
"@types/koa-mount": "^4.0.1",
|
|
42
42
|
"@types/koa-static": "^4.0.2",
|
|
43
|
-
"@types/koa__router": "^8.0.
|
|
43
|
+
"@types/koa__router": "^8.0.11",
|
|
44
44
|
"@types/minimist": "^1.2.2",
|
|
45
45
|
"@types/node": "^12.19.9",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
47
|
-
"@typescript-eslint/parser": "^
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
|
47
|
+
"@typescript-eslint/parser": "^5.10.2",
|
|
48
48
|
"@types/decompress": "^4.2.4",
|
|
49
|
-
"eslint": "^
|
|
49
|
+
"eslint": "^8.8.0",
|
|
50
50
|
"eslint-plugin-header": "^3.1.1",
|
|
51
|
-
"typescript": "^4.
|
|
51
|
+
"typescript": "^4.5.5"
|
|
52
52
|
},
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"author": "Visual Studio Code Team",
|