@vscode/test-web 0.0.48 → 0.0.50
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/README.md +10 -1
- package/out/index.d.ts +4 -0
- package/out/index.js +26 -2
- package/package.json +18 -18
package/README.md
CHANGED
|
@@ -31,12 +31,20 @@ vscode-test-web --browserType=chromium --extensionDevelopmentPath=$extensionLoca
|
|
|
31
31
|
|
|
32
32
|
Open VS Code in the Browser on a folder with test data from the local disk:
|
|
33
33
|
|
|
34
|
-
```
|
|
34
|
+
```sh
|
|
35
35
|
vscode-test-web --browserType=chromium --extensionDevelopmentPath=$extensionLocation $testDataLocation
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
VS Code for the Web will open on a virtual workspace (scheme `vscode-test-web`), backed by a file system provider that gets the file/folder data from the local disk. Changes to the file system are kept in memory and are not written back to disk.
|
|
39
39
|
|
|
40
|
+
Open VS Code in the Browser with external network access:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
vscode-test-web --browserType=chromium --browserOption=--disable-web-security extensionDevelopmentPath=$extensionLocation
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This allows the extension being tested to make network requests to external hosts.
|
|
47
|
+
|
|
40
48
|
Via API:
|
|
41
49
|
|
|
42
50
|
```ts
|
|
@@ -68,6 +76,7 @@ CLI options:
|
|
|
68
76
|
|Option|Argument Description|
|
|
69
77
|
|-----|-----|
|
|
70
78
|
| --browser | The browser to launch: `chromium` (default), `firefox`, `webkit` or `none`. |
|
|
79
|
+
| --browserOption | Command line argument to use when launching the browser instance. Argument can be provided multiple times. |
|
|
71
80
|
| --extensionDevelopmentPath | A path pointing to an extension under development to include. |
|
|
72
81
|
| --extensionTestsPath | A path to a test module to run. |
|
|
73
82
|
| --quality | `insiders` (default), or `stable`. Ignored when sourcesPath is provided. |
|
package/out/index.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export interface Options {
|
|
|
10
10
|
* Browser to open: 'chromium' | 'firefox' | 'webkit' | 'none'.
|
|
11
11
|
*/
|
|
12
12
|
browserType: BrowserType;
|
|
13
|
+
/**
|
|
14
|
+
* Browser command line options.
|
|
15
|
+
*/
|
|
16
|
+
browserOptions?: string[];
|
|
13
17
|
/**
|
|
14
18
|
* Absolute path to folder that contains one or more extensions (in subfolders).
|
|
15
19
|
* Extension folders include a `package.json` extension manifest.
|
package/out/index.js
CHANGED
|
@@ -120,6 +120,9 @@ async function openBrowser(endpoint, options, configPage) {
|
|
|
120
120
|
return undefined;
|
|
121
121
|
}
|
|
122
122
|
const args = [];
|
|
123
|
+
if (options.browserOptions) {
|
|
124
|
+
args.push(...options.browserOptions);
|
|
125
|
+
}
|
|
123
126
|
if (process.platform === 'linux' && options.browserType === 'chromium') {
|
|
124
127
|
args.push('--no-sandbox');
|
|
125
128
|
}
|
|
@@ -219,7 +222,24 @@ function validatePermissions(permissions) {
|
|
|
219
222
|
if (Array.isArray(permissions) && permissions.every(isValidPermission)) {
|
|
220
223
|
return permissions;
|
|
221
224
|
}
|
|
222
|
-
console.log(`Invalid permission`);
|
|
225
|
+
console.log(`Invalid permission: ${permissions}`);
|
|
226
|
+
showHelp();
|
|
227
|
+
process.exit(-1);
|
|
228
|
+
}
|
|
229
|
+
function validateBrowserOptions(browserOptions) {
|
|
230
|
+
if (browserOptions === undefined) {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
function isValidOption(p) {
|
|
234
|
+
return typeof p === 'string';
|
|
235
|
+
}
|
|
236
|
+
if (isValidOption(browserOptions)) {
|
|
237
|
+
return [browserOptions];
|
|
238
|
+
}
|
|
239
|
+
if (Array.isArray(browserOptions) && browserOptions.every(isValidOption)) {
|
|
240
|
+
return browserOptions;
|
|
241
|
+
}
|
|
242
|
+
console.log(`Invalid browser option: ${browserOptions}`);
|
|
223
243
|
showHelp();
|
|
224
244
|
process.exit(-1);
|
|
225
245
|
}
|
|
@@ -328,6 +348,7 @@ function validatePortNumber(port) {
|
|
|
328
348
|
function showHelp() {
|
|
329
349
|
console.log('Usage:');
|
|
330
350
|
console.log(` --browser 'chromium' | 'firefox' | 'webkit' | 'none': The browser to launch. [Optional, defaults to 'chromium']`);
|
|
351
|
+
console.log(` --browserOption option: Command line argument to use when launching the browser instance. [Optional, Multiple]`);
|
|
331
352
|
console.log(` --extensionDevelopmentPath path: A path pointing to an extension under development to include. [Optional]`);
|
|
332
353
|
console.log(` --extensionTestsPath path: A path to a test module to run. [Optional]`);
|
|
333
354
|
console.log(` --quality 'insiders' | 'stable' [Optional, default 'insiders', ignored when running from sources]`);
|
|
@@ -359,7 +380,7 @@ async function cliMain() {
|
|
|
359
380
|
const manifest = require('../package.json');
|
|
360
381
|
console.log(`${manifest.name}: ${manifest.version}`);
|
|
361
382
|
const options = {
|
|
362
|
-
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browser', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port', 'testRunnerDataDir'],
|
|
383
|
+
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browser', 'browserOption', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port', 'testRunnerDataDir'],
|
|
363
384
|
boolean: ['open-devtools', 'headless', 'hideServerLog', 'printServerLog', 'help', 'verbose', 'coi', 'esm'],
|
|
364
385
|
unknown: arg => {
|
|
365
386
|
if (arg.startsWith('-')) {
|
|
@@ -375,6 +396,7 @@ async function cliMain() {
|
|
|
375
396
|
showHelp();
|
|
376
397
|
process.exit();
|
|
377
398
|
}
|
|
399
|
+
const browserOptions = validateBrowserOptions(args.browserOption);
|
|
378
400
|
const browserType = validateBrowserType(args);
|
|
379
401
|
const extensionTestsPath = await validatePathOrUndefined(args, 'extensionTestsPath', true);
|
|
380
402
|
const extensionDevelopmentPath = await validatePathOrUndefined(args, 'extensionDevelopmentPath');
|
|
@@ -410,6 +432,7 @@ async function cliMain() {
|
|
|
410
432
|
runTests({
|
|
411
433
|
extensionTestsPath,
|
|
412
434
|
extensionDevelopmentPath,
|
|
435
|
+
browserOptions,
|
|
413
436
|
browserType,
|
|
414
437
|
quality,
|
|
415
438
|
devTools,
|
|
@@ -436,6 +459,7 @@ async function cliMain() {
|
|
|
436
459
|
else {
|
|
437
460
|
open({
|
|
438
461
|
extensionDevelopmentPath,
|
|
462
|
+
browserOptions,
|
|
439
463
|
browserType,
|
|
440
464
|
quality,
|
|
441
465
|
devTools,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/test-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"install-extensions": "npm i --prefix=fs-provider && npm i --prefix=sample",
|
|
6
6
|
"compile": "tsc -p ./ && npm run compile-fs-provider",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@koa/router": "^12.0.1",
|
|
27
|
-
"@koa/cors": "^
|
|
27
|
+
"@koa/cors": "^5.0.0",
|
|
28
28
|
"koa": "^2.14.2",
|
|
29
29
|
"koa-morgan": "^1.0.1",
|
|
30
30
|
"koa-mount": "^4.0.0",
|
|
31
31
|
"koa-static": "^5.0.0",
|
|
32
32
|
"minimist": "^1.2.8",
|
|
33
|
-
"playwright": "^1.
|
|
34
|
-
"@playwright/browser-chromium": "^1.
|
|
33
|
+
"playwright": "^1.40.1",
|
|
34
|
+
"@playwright/browser-chromium": "^1.40.1",
|
|
35
35
|
"vscode-uri": "^3.0.8",
|
|
36
36
|
"http-proxy-agent": "^7.0.0",
|
|
37
37
|
"https-proxy-agent": "^7.0.2",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"gunzip-maybe": "^1.4.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/koa": "^2.13.
|
|
43
|
-
"@types/koa-morgan": "^1.0.
|
|
44
|
-
"@types/koa-mount": "^4.0.
|
|
45
|
-
"@types/koa-static": "^4.0.
|
|
46
|
-
"@types/koa__router": "^12.0.
|
|
47
|
-
"@types/minimist": "^1.2.
|
|
48
|
-
"@types/node": "^20.
|
|
49
|
-
"@types/gunzip-maybe": "^1.4.
|
|
50
|
-
"@types/tar-fs": "^2.0.
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
52
|
-
"@typescript-eslint/parser": "^6.
|
|
53
|
-
"eslint": "^8.
|
|
42
|
+
"@types/koa": "^2.13.12",
|
|
43
|
+
"@types/koa-morgan": "^1.0.8",
|
|
44
|
+
"@types/koa-mount": "^4.0.5",
|
|
45
|
+
"@types/koa-static": "^4.0.4",
|
|
46
|
+
"@types/koa__router": "^12.0.4",
|
|
47
|
+
"@types/minimist": "^1.2.5",
|
|
48
|
+
"@types/node": "^20.10.1",
|
|
49
|
+
"@types/gunzip-maybe": "^1.4.2",
|
|
50
|
+
"@types/tar-fs": "^2.0.4",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
52
|
+
"@typescript-eslint/parser": "^6.13.1",
|
|
53
|
+
"eslint": "^8.54.0",
|
|
54
54
|
"eslint-plugin-header": "^3.1.1",
|
|
55
|
-
"typescript": "^5.
|
|
55
|
+
"typescript": "^5.3.2"
|
|
56
56
|
},
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"author": "Visual Studio Code Team",
|
|
@@ -63,4 +63,4 @@
|
|
|
63
63
|
"bugs": {
|
|
64
64
|
"url": "https://github.com/microsoft/vscode-test-web/issues"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|