@vscode/test-web 0.0.77 → 0.0.79

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.
@@ -65,7 +65,7 @@ export interface Options {
65
65
  */
66
66
  coi?: boolean;
67
67
  /**
68
- * If set, serves the page with ESM usage.
68
+ * If set to true, serves the page with ESM usage, if set to false, serves the page with AMD usage. If not set, ESM is used if the build supports it.
69
69
  */
70
70
  esm?: boolean;
71
71
  /**
@@ -29,7 +29,7 @@ async function runTests(options) {
29
29
  extensionPaths: options.extensionPaths,
30
30
  extensionIds: options.extensionIds,
31
31
  coi: !!options.coi,
32
- esm: !!options.esm,
32
+ esm: options.esm,
33
33
  };
34
34
  const host = options.host ?? 'localhost';
35
35
  const port = options.port ?? 3000;
@@ -95,7 +95,7 @@ async function open(options) {
95
95
  extensionPaths: options.extensionPaths,
96
96
  extensionIds: options.extensionIds,
97
97
  coi: !!options.coi,
98
- esm: !!options.esm,
98
+ esm: options.esm,
99
99
  };
100
100
  const host = options.host ?? 'localhost';
101
101
  const port = options.port ?? 3000;
@@ -129,8 +129,11 @@ async function openBrowser(endpoint, options, configPage) {
129
129
  if (options.waitForDebugger) {
130
130
  args.push(`--remote-debugging-port=${options.waitForDebugger}`);
131
131
  }
132
+ if (options.devTools && options.browserType === 'chromium') {
133
+ args.push('--auto-open-devtools-for-tabs');
134
+ }
132
135
  const headless = options.headless ?? options.extensionTestsPath !== undefined;
133
- const browser = await browserType.launch({ headless, args, devtools: options.devTools });
136
+ const browser = await browserType.launch({ headless, args });
134
137
  const context = await browser.newContext({ viewport: null });
135
138
  if (options.permissions) {
136
139
  context.grantPermissions(options.permissions);
@@ -179,6 +182,9 @@ function validateBooleanOrUndefined(options, name) {
179
182
  if (value === undefined || typeof value === 'boolean') {
180
183
  return value;
181
184
  }
185
+ if (value === null) {
186
+ return undefined;
187
+ }
182
188
  console.log(`'${name}' needs to be a boolean value.`);
183
189
  showHelp();
184
190
  process.exit(-1);
@@ -372,7 +378,7 @@ function showHelp() {
372
378
  console.log(` --headless: Whether to hide the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);
373
379
  console.log(` --permission: Permission granted in the opened browser: e.g. 'clipboard-read', 'clipboard-write'. [Optional, Multiple]`);
374
380
  console.log(` --coi: Enables cross origin isolation [Optional]`);
375
- console.log(` --esm: Serve the ESM variant of VS Code [Optional]`);
381
+ console.log(` --esm: If set to true, serves the page with ESM loader, if set to false, serves the page with AMD loader. If not set, ESM is used if the build supports it. [Optional]`);
376
382
  console.log(` --folder-uri: workspace to open VS Code on. Ignored when folderPath is provided. [Optional]`);
377
383
  console.log(` --extensionPath: A path pointing to a folder containing additional extensions to include [Optional, Multiple]`);
378
384
  console.log(` --extensionId: The id of an extension include. The format is '\${publisher}.\${name}'. Append '@prerelease' to use a prerelease version [Optional, Multiple]`);
@@ -396,6 +402,9 @@ async function cliMain() {
396
402
  const options = {
397
403
  string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browser', 'browserOption', 'browserType', 'quality', 'version', 'commit', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port', 'testRunnerDataDir'],
398
404
  boolean: ['open-devtools', 'headless', 'hideServerLog', 'printServerLog', 'help', 'verbose', 'coi', 'esm'],
405
+ default: {
406
+ esm: null
407
+ },
399
408
  unknown: arg => {
400
409
  if (arg.startsWith('-')) {
401
410
  console.log(`Unknown argument ${arg}`);
@@ -144,7 +144,7 @@ function default_1(config) {
144
144
  if (config.build.type === 'sources') {
145
145
  const builtInExtensions = await (0, extensions_1.getScannedBuiltinExtensions)(config.build.location);
146
146
  const productOverrides = await getProductOverrides(config.build.location);
147
- const esm = config.esm || await isESM(config.build.location);
147
+ const esm = config.esm ?? await isESM(config.build.location);
148
148
  console.log('Using ESM loader:', esm);
149
149
  const devCSSModules = esm ? await getDevCssModules(config.build.location) : [];
150
150
  ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/sources`, true, esm, devCSSModules, builtInExtensions, {
@@ -155,13 +155,17 @@ function default_1(config) {
155
155
  }
156
156
  else if (config.build.type === 'static') {
157
157
  const baseUrl = `${ctx.protocol}://${ctx.host}/static/build`;
158
- ctx.state.workbench = new Workbench(baseUrl, false, config.esm, [], [], {
158
+ const esm = config.esm ?? await isESM(config.build.location);
159
+ console.log('Using ESM loader:', esm);
160
+ ctx.state.workbench = new Workbench(baseUrl, false, esm, [], [], {
159
161
  webEndpointUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/build`,
160
162
  webviewContentExternalBaseUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/build/out/vs/workbench/contrib/webview/browser/pre/`
161
163
  });
162
164
  }
163
165
  else if (config.build.type === 'cdn') {
164
- ctx.state.workbench = new Workbench(config.build.uri, false, config.esm, []);
166
+ const esm = config.esm ?? true;
167
+ console.log('Using ESM loader:', esm);
168
+ ctx.state.workbench = new Workbench(config.build.uri, false, esm, []);
165
169
  }
166
170
  await next();
167
171
  });
@@ -191,13 +195,6 @@ async function getDevCssModules(vsCodeDevLocation) {
191
195
  return glob.glob('**/*.css', { cwd: path.join(vsCodeDevLocation, 'out') });
192
196
  }
193
197
  async function isESM(vsCodeDevLocation) {
194
- try {
195
- const packageJSON = await fs_1.promises.readFile(path.join(vsCodeDevLocation, 'out', 'package.json'));
196
- return JSON.parse(packageJSON.toString()).type === 'module';
197
- }
198
- catch (e) {
199
- // ignore
200
- }
201
198
  try {
202
199
  const packageJSON = await fs_1.promises.readFile(path.join(vsCodeDevLocation, 'package.json'));
203
200
  return JSON.parse(packageJSON.toString()).type === 'module';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/test-web",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "scripts": {
5
5
  "install-extensions": "npm i --prefix=fs-provider && npm i --prefix=sample",
6
6
  "compile": "tsc -b ./ && npm run compile-fs-provider",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@koa/cors": "^5.0.0",
27
- "@koa/router": "^15.0.0",
28
- "@playwright/browser-chromium": "^1.57.0",
27
+ "@koa/router": "^15.3.0",
28
+ "@playwright/browser-chromium": "^1.58.0",
29
29
  "tinyglobby": "^0.2.15",
30
30
  "gunzip-maybe": "^1.4.2",
31
31
  "http-proxy-agent": "^7.0.2",
@@ -35,13 +35,13 @@
35
35
  "koa-mount": "^4.2.0",
36
36
  "koa-static": "^5.0.0",
37
37
  "minimist": "^1.2.8",
38
- "playwright": "^1.57.0",
38
+ "playwright": "^1.58.0",
39
39
  "tar-fs": "^3.1.1",
40
40
  "vscode-uri": "^3.1.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@eslint/eslintrc": "^3.3.3",
44
- "@eslint/js": "^9.39.1",
44
+ "@eslint/js": "^9.39.2",
45
45
  "@types/gunzip-maybe": "^1.4.3",
46
46
  "@types/koa": "^3.0.1",
47
47
  "@types/koa__router": "^12.0.5",
@@ -51,10 +51,10 @@
51
51
  "@types/minimist": "^1.2.5",
52
52
  "@types/node": "^20.16.13",
53
53
  "@types/tar-fs": "^2.0.4",
54
- "@typescript-eslint/eslint-plugin": "^8.48.1",
55
- "@typescript-eslint/parser": "^8.48.1",
56
- "eslint": "^9.39.1",
57
- "@tony.ganchev/eslint-plugin-header": "^3.1.11",
54
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
55
+ "@typescript-eslint/parser": "^8.54.0",
56
+ "eslint": "^9.39.2",
57
+ "@tony.ganchev/eslint-plugin-header": "^3.2.0",
58
58
  "typescript": "^5.9.3"
59
59
  },
60
60
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  <link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/favicon.ico" type="image/x-icon" />
27
27
  <link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/manifest.json">
28
28
 
29
- <link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.main.css" />
29
+ <link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.main.internal.css" />
30
30
  <style id="vscode-css-modules" type="text/css" media="screen"></style>
31
31
  </head>
32
32