@vscode/test-web 0.0.36 → 0.0.38

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 CHANGED
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+ ## 0.0.37
3
+ * new option `--testRunnerDataDir` to set the temporary folder for storing the VS Code builds used for running the tests
4
+
5
+
2
6
  ## 0.0.28
3
7
  * new option `--coi` to enable cross origin isolation.
4
8
 
package/README.md CHANGED
@@ -83,6 +83,7 @@ CLI options:
83
83
  | --open-devtools | If set, opens the dev tools in the browser. |
84
84
  | --verbose | If set, prints out more information when running the server. |
85
85
  | --printServerLog | If set, prints the server access log. |
86
+ | --testRunnerDataDir | If set, the temporary folder for storing the VS Code builds used for running the tests |
86
87
  | folderPath | A local folder to open VS Code on. The folder content will be available as a virtual file system and opened as workspace. |
87
88
 
88
89
  Corresponding options are available in the API.
package/out/index.d.ts CHANGED
@@ -111,6 +111,10 @@ export interface Options {
111
111
  * The host name to start the server on. Defaults to `localhost`
112
112
  */
113
113
  host?: string;
114
+ /**
115
+ * The temporary folder for storing the VS Code builds used for running the tests. Defaults to `$CURRENT_WORKING_DIR/.vscode-test-web`.
116
+ */
117
+ testRunnerDataDir?: string;
114
118
  }
115
119
  export interface Disposable {
116
120
  dispose(): void;
package/out/index.js CHANGED
@@ -39,8 +39,14 @@ async function runTests(options) {
39
39
  const context = await openBrowser(endpoint, options);
40
40
  if (context) {
41
41
  context.once('close', () => server.close());
42
+ const unreportedOutput = [];
42
43
  await context.exposeFunction('codeAutomationLog', (type, args) => {
43
- console[type](...args);
44
+ try {
45
+ console[type](...args);
46
+ }
47
+ catch (_e) {
48
+ unreportedOutput.push({ type, args });
49
+ }
44
50
  });
45
51
  await context.exposeFunction('codeAutomationExit', async (code) => {
46
52
  try {
@@ -49,6 +55,10 @@ async function runTests(options) {
49
55
  catch (error) {
50
56
  console.error(`Error when closing browser: ${error}`);
51
57
  }
58
+ if (unreportedOutput.length) {
59
+ console.error(`There were ${unreportedOutput.length} messages that could not be reported to the console:`);
60
+ unreportedOutput.forEach(({ type, args }) => console[type](...args));
61
+ }
52
62
  server.close();
53
63
  if (code === 0) {
54
64
  s();
@@ -73,7 +83,8 @@ async function getBuild(options) {
73
83
  };
74
84
  }
75
85
  const quality = options.quality || options.version;
76
- return await (0, download_1.downloadAndUnzipVSCode)(quality === 'stable' ? 'stable' : 'insider');
86
+ const testRunnerDataDir = options.testRunnerDataDir ?? path.resolve(process.cwd(), '.vscode-test-web');
87
+ return await (0, download_1.downloadAndUnzipVSCode)(quality === 'stable' ? 'stable' : 'insider', testRunnerDataDir);
77
88
  }
78
89
  async function open(options) {
79
90
  const config = {
@@ -334,6 +345,7 @@ function showHelp() {
334
345
  console.log(` --open-devtools: If set, opens the dev tools. [Optional]`);
335
346
  console.log(` --verbose: If set, prints out more information when running the server. [Optional]`);
336
347
  console.log(` --printServerLog: If set, prints the server access log. [Optional]`);
348
+ console.log(` --testRunnerDataDir: If set, the temporary folder for storing the VS Code builds used for running the tests. [Optional, defaults to '$CURRENT_WORKING_DIR/.vscode-test-web']`);
337
349
  console.log(` folderPath. A local folder to open VS Code on. The folder content will be available as a virtual file system. [Optional]`);
338
350
  }
339
351
  async function cliMain() {
@@ -347,7 +359,7 @@ async function cliMain() {
347
359
  const manifest = require('../package.json');
348
360
  console.log(`${manifest.name}: ${manifest.version}`);
349
361
  const options = {
350
- string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browser', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port'],
362
+ string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browser', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'extensionId', 'sourcesPath', 'host', 'port', 'testRunnerDataDir'],
351
363
  boolean: ['open-devtools', 'headless', 'hideServerLog', 'printServerLog', 'help', 'verbose', 'coi', 'esm'],
352
364
  unknown: arg => {
353
365
  if (arg.startsWith('-')) {
@@ -379,6 +391,7 @@ async function cliMain() {
379
391
  const host = validateStringOrUndefined(args, 'host');
380
392
  const coi = validateBooleanOrUndefined(args, 'coi');
381
393
  const esm = validateBooleanOrUndefined(args, 'esm');
394
+ const testRunnerDataDir = validateStringOrUndefined(args, 'testRunnerDataDir');
382
395
  const waitForDebugger = validatePortNumber(args.waitForDebugger);
383
396
  let folderUri = validateStringOrUndefined(args, 'folder-uri');
384
397
  let folderPath;
@@ -413,7 +426,8 @@ async function cliMain() {
413
426
  esm,
414
427
  coi,
415
428
  host,
416
- port
429
+ port,
430
+ testRunnerDataDir
417
431
  }).catch(e => {
418
432
  console.log('Error running tests:', e);
419
433
  process.exit(1);
@@ -438,7 +452,8 @@ async function cliMain() {
438
452
  esm,
439
453
  coi,
440
454
  host,
441
- port
455
+ port,
456
+ testRunnerDataDir
442
457
  });
443
458
  }
444
459
  }
@@ -14,8 +14,6 @@ const createHttpProxyAgent = require("http-proxy-agent");
14
14
  const url_1 = require("url");
15
15
  const decompress = require("decompress");
16
16
  const decompressTargz = require("decompress-targz");
17
- const extensionRoot = process.cwd();
18
- const vscodeTestDir = path.resolve(extensionRoot, '.vscode-test-web');
19
17
  async function getLatestVersion(quality) {
20
18
  const update = await fetchJSON(`https://update.code.visualstudio.com/api/update/web-standalone/${quality}/latest`);
21
19
  return update;
@@ -65,7 +63,7 @@ async function unzip(source, destination, message) {
65
63
  });
66
64
  process.stdout.write(`${reset}${message}: complete\n`);
67
65
  }
68
- async function downloadAndUnzipVSCode(quality) {
66
+ async function downloadAndUnzipVSCode(quality, vscodeTestDir) {
69
67
  const info = await getLatestVersion(quality);
70
68
  const folderName = `vscode-web-${quality}-${info.version}`;
71
69
  const downloadedPath = path.resolve(vscodeTestDir, folderName);
@@ -77,7 +75,7 @@ async function downloadAndUnzipVSCode(quality) {
77
75
  }
78
76
  await fs_1.promises.mkdir(vscodeTestDir, { recursive: true });
79
77
  const productName = `VS Code ${quality === 'stable' ? 'Stable' : 'Insiders'}`;
80
- const tmpArchiveName = `vscode-web-${quality}-${info.version}-tmp`;
78
+ const tmpArchiveName = path.join(vscodeTestDir, `vscode-web-${quality}-${info.version}-tmp`);
81
79
  try {
82
80
  await download(info.url, tmpArchiveName, `Downloading ${productName}`);
83
81
  await unzip(tmpArchiveName, downloadedPath, `Unpacking ${productName}`);
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Licensed under the MIT License. See License.txt in the project root for license information.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- var _a;
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
8
7
  exports.getScannedBuiltinExtensions = exports.prebuiltExtensionsLocation = exports.scanForExtensions = void 0;
9
8
  const fs_1 = require("fs");
@@ -48,7 +47,7 @@ exports.scanForExtensions = scanForExtensions;
48
47
  exports.prebuiltExtensionsLocation = '.build/builtInExtensions';
49
48
  async function getScannedBuiltinExtensions(vsCodeDevLocation) {
50
49
  // use the build utility as to not duplicate the code
51
- const extensionsUtil = await (_a = path.join(vsCodeDevLocation, 'build', 'lib', 'extensions.js'), Promise.resolve().then(() => require(_a)));
50
+ const extensionsUtil = await Promise.resolve(`${path.join(vsCodeDevLocation, 'build', 'lib', 'extensions.js')}`).then(s => require(s));
52
51
  const localExtensions = extensionsUtil.scanBuiltinExtensions(path.join(vsCodeDevLocation, 'extensions'));
53
52
  const prebuiltExtensions = extensionsUtil.scanBuiltinExtensions(path.join(vsCodeDevLocation, exports.prebuiltExtensionsLocation));
54
53
  for (const ext of localExtensions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/test-web",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "scripts": {
5
5
  "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",
6
6
  "compile": "tsc -p ./ && yarn compile-fs-provider",
@@ -30,7 +30,7 @@
30
30
  "koa-mount": "^4.0.0",
31
31
  "koa-static": "^5.0.0",
32
32
  "minimist": "^1.2.8",
33
- "playwright": "^1.32.0",
33
+ "playwright": "^1.32.2",
34
34
  "vscode-uri": "^3.0.7",
35
35
  "http-proxy-agent": "^5.0.0",
36
36
  "https-proxy-agent": "^5.0.1",
@@ -39,19 +39,19 @@
39
39
  "get-stream": "6.0.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/koa": "^2.13.5",
42
+ "@types/koa": "^2.13.6",
43
43
  "@types/koa-morgan": "^1.0.5",
44
44
  "@types/koa-mount": "^4.0.2",
45
45
  "@types/koa-static": "^4.0.2",
46
46
  "@types/koa__router": "^12.0.0",
47
47
  "@types/minimist": "^1.2.2",
48
48
  "@types/node": "16.x",
49
- "@typescript-eslint/eslint-plugin": "^5.56.0",
50
- "@typescript-eslint/parser": "^5.56.0",
49
+ "@typescript-eslint/eslint-plugin": "^5.57.0",
50
+ "@typescript-eslint/parser": "^5.57.0",
51
51
  "@types/decompress": "^4.2.4",
52
- "eslint": "^8.36.0",
52
+ "eslint": "^8.37.0",
53
53
  "eslint-plugin-header": "^3.1.1",
54
- "typescript": "^4.9.5"
54
+ "typescript": "^5.0.3"
55
55
  },
56
56
  "license": "MIT",
57
57
  "author": "Visual Studio Code Team",