@vscode/test-web 0.0.47 → 0.0.49

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.
@@ -36,13 +36,13 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/vscode": "^1.81.0",
39
- "@types/webpack-env": "^1.18.2",
40
- "ts-loader": "^9.4.4",
41
- "webpack": "^5.88.2",
39
+ "@types/webpack-env": "^1.18.3",
40
+ "ts-loader": "^9.5.0",
41
+ "webpack": "^5.89.0",
42
42
  "webpack-cli": "^5.1.4",
43
43
  "process": "^0.11.10",
44
44
  "path-browserify": "^1.0.1",
45
45
  "request-light": "^0.7.0",
46
- "vscode-uri": "^3.0.7"
46
+ "vscode-uri": "^3.0.8"
47
47
  }
48
48
  }
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/out/server/app.js CHANGED
@@ -22,14 +22,17 @@ async function createApp(config) {
22
22
  allowMethods: ['GET'],
23
23
  credentials: true,
24
24
  origin: (ctx) => {
25
- if (/^https:\/\/[^.]+\.vscode-cdn\.net$/.test(ctx.get('Origin')) || // needed for the webviewContent
26
- /^https:\/\/[^.]+\.vscode-webview\.net$/.test(ctx.get('Origin'))) {
27
- return ctx.get('Origin');
25
+ const origin = ctx.get('Origin');
26
+ if (/^https:\/\/[^.]+\.vscode-cdn\.net$/.test(origin) || // needed for the webviewContent
27
+ /^https:\/\/[^.]+\.vscode-webview\.net$/.test(origin) ||
28
+ new RegExp(`^${ctx.protocol}://[^.]+\\.${ctx.host}$`).test(origin) // match subdomains of localhost
29
+ ) {
30
+ return origin;
28
31
  }
29
32
  return undefined;
30
33
  },
31
34
  }));
32
- if (config.build.type !== 'sources') {
35
+ if (config.build.type !== 'sources' && config.build.type !== 'static') {
33
36
  // CSP: frame-ancestors
34
37
  app.use((ctx, next) => {
35
38
  ctx.set('Content-Security-Policy', `frame-ancestors 'none'`);
@@ -111,10 +111,18 @@ function default_1(config) {
111
111
  if (config.build.type === 'sources') {
112
112
  const builtInExtensions = await (0, extensions_1.getScannedBuiltinExtensions)(config.build.location);
113
113
  const productOverrides = await getProductOverrides(config.build.location);
114
- ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/sources`, true, config.esm, builtInExtensions, productOverrides);
114
+ ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/sources`, true, config.esm, builtInExtensions, {
115
+ ...productOverrides,
116
+ webEndpointUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/sources`,
117
+ webviewContentExternalBaseUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/sources/out/vs/workbench/contrib/webview/browser/pre/`
118
+ });
115
119
  }
116
120
  else if (config.build.type === 'static') {
117
- ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/build`, false, config.esm);
121
+ const baseUrl = `${ctx.protocol}://${ctx.host}/static/build`;
122
+ ctx.state.workbench = new Workbench(baseUrl, false, config.esm, [], {
123
+ webEndpointUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/build`,
124
+ webviewContentExternalBaseUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/build/out/vs/workbench/contrib/webview/browser/pre/`
125
+ });
118
126
  }
119
127
  else if (config.build.type === 'cdn') {
120
128
  ctx.state.workbench = new Workbench(config.build.uri, false, config.esm);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@vscode/test-web",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "scripts": {
5
- "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",
6
- "compile": "tsc -p ./ && yarn compile-fs-provider",
5
+ "install-extensions": "npm i --prefix=fs-provider && npm i --prefix=sample",
6
+ "compile": "tsc -p ./ && npm run compile-fs-provider",
7
7
  "watch": "tsc -w -p ./",
8
- "prepack": "yarn compile",
8
+ "prepack": "npm run compile",
9
9
  "test": "eslint src --ext ts && tsc --noEmit",
10
10
  "preversion": "npm test",
11
11
  "postversion": "git push && git push --tags",
12
- "compile-fs-provider": "yarn --cwd=fs-provider compile-web",
13
- "compile-sample": "yarn --cwd=sample compile-web",
12
+ "compile-fs-provider": "npm run --prefix=fs-provider compile-web",
13
+ "compile-sample": "npm run --prefix=sample compile-web",
14
14
  "sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample sample/test-workspace",
15
15
  "sample-tests": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --extensionTestsPath=sample/dist/web/test/suite/index.js --headless=true sample/test-workspace",
16
16
  "empty": "npm run compile && node ."
@@ -23,36 +23,36 @@
23
23
  "node": ">=16"
24
24
  },
25
25
  "dependencies": {
26
- "@koa/router": "^12.0.0",
26
+ "@koa/router": "^12.0.1",
27
27
  "@koa/cors": "^4.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.38.1",
34
- "@playwright/browser-chromium": "^1.38.1",
35
- "vscode-uri": "^3.0.7",
33
+ "playwright": "^1.40.1",
34
+ "@playwright/browser-chromium": "^1.40.1",
35
+ "vscode-uri": "^3.0.8",
36
36
  "http-proxy-agent": "^7.0.0",
37
37
  "https-proxy-agent": "^7.0.2",
38
38
  "tar-fs": "^3.0.4",
39
39
  "gunzip-maybe": "^1.4.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/koa": "^2.13.9",
43
- "@types/koa-morgan": "^1.0.6",
44
- "@types/koa-mount": "^4.0.3",
45
- "@types/koa-static": "^4.0.2",
46
- "@types/koa__router": "^12.0.1",
47
- "@types/minimist": "^1.2.3",
48
- "@types/node": "^20.8.4",
49
- "@types/gunzip-maybe": "^1.4.0",
50
- "@types/tar-fs": "^2.0.2",
51
- "@typescript-eslint/eslint-plugin": "^6.7.3",
52
- "@typescript-eslint/parser": "^6.7.3",
53
- "eslint": "^8.51.0",
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.2.2"
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
+ }