@vscode/test-web 0.0.14 → 0.0.15

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 CHANGED
@@ -1,15 +1,17 @@
1
1
  # @vscode/test-web
2
2
 
3
- This module helps testing [VS Code web extensions](https://code.visualstudio.com/api/extension-guides/web-extensions) locally.
3
+ This module helps testing VS Code web extensions locally.
4
4
 
5
5
  [![Test Status Badge](https://github.com/microsoft/vscode-test-web/workflows/Tests/badge.svg)](https://github.com/microsoft/vscode-test-web/actions/workflows/tests.yml)
6
6
  [![npm Package](https://img.shields.io/npm/v/@vscode/test-web.svg?style=flat-square)](https://www.npmjs.org/package/@vscode/test-web)
7
7
  [![NPM Downloads](https://img.shields.io/npm/dm/@vscode/test-web.svg)](https://npmjs.org/package/@vscode/test-web)
8
8
 
9
9
 
10
- The node module runs a local web server that serves VS Code for the browser including the extensions located at the given local path. Additionally the extension tests are automatically run.
10
+ See the [web extensions guide](https://code.visualstudio.com/api/extension-guides/web-extensions) to learn about web extensions.
11
11
 
12
- The node module providers a command line as well as an API.
12
+ The node module runs a local web server that serves VS Code in the browser including the extension under development. Additionally the extension tests are automatically run.
13
+
14
+ The node module provides a command line as well as an API.
13
15
 
14
16
  ## Usage
15
17
 
@@ -39,19 +41,23 @@ Via API:
39
41
 
40
42
  ```ts
41
43
  async function go() {
42
- try {
43
- // The folder containing the Extension Manifest package.json
44
- const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
45
-
46
- // The path to module with the test runner and tests
47
- const extensionTestsPath = path.resolve(__dirname, './suite/index');
48
-
49
- // Start a web server that serves VSCode in a browser, run the tests
50
- await runTests({ browserType: 'chromium', extensionDevelopmentPath, extensionTestsPath });
51
- } catch (err) {
52
- console.error('Failed to run tests');
53
- process.exit(1);
54
- }
44
+ try {
45
+ // The folder containing the Extension Manifest package.json
46
+ const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
47
+
48
+ // The path to module with the test runner and tests
49
+ const extensionTestsPath = path.resolve(__dirname, './suite/index');
50
+
51
+ // Start a web server that serves VSCode in a browser, run the tests
52
+ await runTests({
53
+ browserType: 'chromium',
54
+ extensionDevelopmentPath
55
+ extensionTestsPath
56
+ });
57
+ } catch (err) {
58
+ console.error('Failed to run tests');
59
+ process.exit(1);
60
+ }
55
61
  }
56
62
 
57
63
  go()
@@ -59,8 +65,8 @@ go()
59
65
 
60
66
  CLI options:
61
67
 
62
- |Option|Argument Description||
63
- |-----|-----|----|
68
+ |Option|Argument Description|
69
+ |-----|-----|
64
70
  | --browserType | The browser to launch: `chromium` (default), `firefox` or `webkit` |
65
71
  | --extensionDevelopmentPath | A path pointing to an extension under development to include. |
66
72
  | --extensionTestsPath | A path to a test module to run. |
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/vscode": "^1.55.0",
27
- "@types/webpack-env": "^1.16.0",
28
- "ts-loader": "^9.2.3",
29
- "webpack": "^5.40.0",
30
- "webpack-cli": "^4.7.2",
27
+ "@types/webpack-env": "^1.16.2",
28
+ "ts-loader": "^9.2.6",
29
+ "webpack": "^5.55.0",
30
+ "webpack-cli": "^4.8.0",
31
31
  "process": "^0.11.10",
32
32
  "path-browserify": "^1.0.1",
33
33
  "request-light": "^0.5.3",
package/out/index.js CHANGED
@@ -241,18 +241,26 @@ function showHelp() {
241
241
  console.log(` folderPath. A local folder to open VS Code on. The folder content will be available as a virtual file system. [Optional]`);
242
242
  }
243
243
  async function cliMain() {
244
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
245
+ const manifest = require('../package.json');
246
+ console.log(`${manifest.name}: ${manifest.version}`);
244
247
  const options = {
245
248
  string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath'],
246
- boolean: ['open-devtools', 'headless', 'hideServerLog'],
249
+ boolean: ['open-devtools', 'headless', 'hideServerLog', 'help'],
247
250
  unknown: arg => {
248
251
  if (arg.startsWith('-')) {
249
252
  console.log(`Unknown argument ${arg}`);
253
+ showHelp();
250
254
  return false;
251
255
  }
252
256
  return true;
253
257
  }
254
258
  };
255
259
  const args = minimist(process.argv.slice(2), options);
260
+ if (args.help) {
261
+ showHelp();
262
+ process.exit();
263
+ }
256
264
  const browserType = valdiateBrowserType(args.browserType);
257
265
  const extensionTestsPath = await validatePathOrUndefined(args, 'extensionTestsPath', true);
258
266
  const extensionDevelopmentPath = await validatePathOrUndefined(args, 'extensionDevelopmentPath');
@@ -70,7 +70,7 @@ async function downloadAndUnzipVSCode(quality) {
70
70
  const folderName = `vscode-web-${quality}-${info.version}`;
71
71
  const downloadedPath = path.resolve(vscodeTestDir, folderName);
72
72
  if ((0, fs_1.existsSync)(downloadedPath) && (0, fs_1.existsSync)(path.join(downloadedPath, 'version'))) {
73
- return { type: 'static', location: downloadedPath };
73
+ return { type: 'static', location: downloadedPath, quality, version: info.version };
74
74
  }
75
75
  if ((0, fs_1.existsSync)(vscodeTestDir)) {
76
76
  await fs_1.promises.rmdir(vscodeTestDir, { recursive: true, maxRetries: 5 });
@@ -95,7 +95,7 @@ async function downloadAndUnzipVSCode(quality) {
95
95
  // ignore
96
96
  }
97
97
  }
98
- return { type: 'static', location: downloadedPath };
98
+ return { type: 'static', location: downloadedPath, quality, version: info.version };
99
99
  }
100
100
  exports.downloadAndUnzipVSCode = downloadAndUnzipVSCode;
101
101
  async function fetch(api) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/test-web",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "scripts": {
5
5
  "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",
6
6
  "compile": "tsc -p ./ && yarn compile-fs-provider",