@vscode/test-web 0.0.11 → 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/.yarnrc ADDED
@@ -0,0 +1 @@
1
+ --ignore-engines true
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.14
4
+ * new option `--extensionPath` : A path pointing to a folder containing additional extensions to include. Argument can be provided multiple times.
5
+ * new option `--permission`: Permission granted to the opened browser: e.g. clipboard-read, clipboard-write. See full list of options [here](https://playwright.dev/docs/1.14/emulation#permissions). Argument can be provided multiple times.
6
+ * new option `--hideServerLog`: If set, hides the server log. Defaults to true when an extensionTestsPath is provided, otherwise false.
7
+ * close server when browser is closed
8
+
9
+ ## 0.0.9
10
+
11
+ * new option `folderPath`: A local folder to open VS Code on. The folder content will be available as a virtual file system and opened as workspace.
12
+
13
+
3
14
  ### 0.0.1 |
4
15
 
5
16
  - Initial version
package/README.md CHANGED
@@ -1,12 +1,17 @@
1
1
  # @vscode/test-web
2
2
 
3
- ![Test Status Badge](https://github.com/microsoft/vscode-test-web/workflows/Tests/badge.svg)
3
+ This module helps testing VS Code web extensions locally.
4
4
 
5
- This module helps testing [VS Code web extensions](https://code.visualstudio.com/api/extension-guides/web-extensions) locally.
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
+ [![npm Package](https://img.shields.io/npm/v/@vscode/test-web.svg?style=flat-square)](https://www.npmjs.org/package/@vscode/test-web)
7
+ [![NPM Downloads](https://img.shields.io/npm/dm/@vscode/test-web.svg)](https://npmjs.org/package/@vscode/test-web)
6
8
 
7
- 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.
8
9
 
9
- The node module providers a command line as well as an API.
10
+ See the [web extensions guide](https://code.visualstudio.com/api/extension-guides/web-extensions) to learn about web extensions.
11
+
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.
10
15
 
11
16
  ## Usage
12
17
 
@@ -30,47 +35,55 @@ Open VS Code in the Browser on a folder with test data from the local disk:
30
35
  vscode-test-web --browserType=chromium --extensionDevelopmentPath=$extensionLocation $testDataLocation
31
36
  ```
32
37
 
33
- VS Code Browser 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.
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.
34
39
 
35
40
  Via API:
36
41
 
37
42
  ```ts
38
43
  async function go() {
39
- try {
40
- // The folder containing the Extension Manifest package.json
41
- const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
42
-
43
- // The path to module with the test runner and tests
44
- const extensionTestsPath = path.resolve(__dirname, './suite/index');
45
-
46
- // Start a web server that serves VSCode in a browser, run the tests
47
- await runTests({ browserType: 'chromium', extensionDevelopmentPath, extensionTestsPath });
48
- } catch (err) {
49
- console.error('Failed to run tests');
50
- process.exit(1);
51
- }
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
+ }
52
61
  }
53
62
 
54
63
  go()
55
64
  ```
56
65
 
57
66
  CLI options:
58
- ```
59
- --browserType 'chromium' | 'firefox' | 'webkit': The browser to launch
60
- --extensionDevelopmentPath path. [Optional]: A path pointing to a extension to include.
61
- --extensionTestsPath path. [Optional]: A path to a test module to run
62
- --version. 'insiders' (Default) | 'stable' | 'sources' [Optional]
63
- --open-devtools. Opens the dev tools [Optional]
64
- --headless. Whether to show the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]
65
- folderPath. A local folder to open VS Code on. The folder content will be available as a virtual file system`
66
67
 
67
- ```
68
+ |Option|Argument Description|
69
+ |-----|-----|
70
+ | --browserType | The browser to launch: `chromium` (default), `firefox` or `webkit` |
71
+ | --extensionDevelopmentPath | A path pointing to an extension under development to include. |
72
+ | --extensionTestsPath | A path to a test module to run. |
73
+ | --version | `insiders` (default), `stable` or `sources`.<br>For sources, also run `yarn web` in a vscode repo |
74
+ | --open-devtools| If set, opens the dev tools |
75
+ | --headless| If set, hides the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. |
76
+ | --hideServerLog| If set, hides the server log. Defaults to true when an extensionTestsPath is provided, otherwise false. |
77
+ | --permission| Permission granted to the opened browser: e.g. `clipboard-read`, `clipboard-write`. See [full list of options](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions). Argument can be provided multiple times. |
78
+ | --folder-uri | URI of the workspace to open VS Code on. Ignored when `folderPath` is provided |
79
+ | --extensionPath | A path pointing to a folder containing additional extensions to include. Argument can be provided multiple times. |
80
+ | folderPath | A local folder to open VS Code on. The folder content will be available as a virtual file system and opened as workspace. |
68
81
 
69
82
  Corresponding options are available in the API.
70
83
 
71
84
  ## Development
72
85
 
73
- - `yarn install`
86
+ - `yarn && yarn install-extensions`
74
87
  - Make necessary changes in [`src`](./src)
75
88
  - `yarn compile` (or `yarn watch`)
76
89
 
@@ -42,7 +42,7 @@ async function getStats(entry) {
42
42
  if (stats === undefined) {
43
43
  if (entry.serverUri) {
44
44
  const url = entry.serverUri.with({ query: 'stat' }).toString();
45
- const response = await request_light_1.xhr({ url: url.toString() });
45
+ const response = await (0, request_light_1.xhr)({ url });
46
46
  if (response.status === 200) {
47
47
  try {
48
48
  const res = JSON.parse(response.responseText);
@@ -67,7 +67,7 @@ async function getEntries(entry) {
67
67
  entry.entries = new Map();
68
68
  if (entry.serverUri) {
69
69
  const url = entry.serverUri.with({ query: 'readdir' }).toString();
70
- const response = await request_light_1.xhr({ url });
70
+ const response = await (0, request_light_1.xhr)({ url });
71
71
  if (response.status === 200) {
72
72
  try {
73
73
  const res = JSON.parse(response.responseText);
@@ -117,7 +117,7 @@ class MountsFileSystemProvider {
117
117
  }
118
118
  const serverUri = entry.serverUri;
119
119
  if (serverUri) {
120
- const response = await request_light_1.xhr({ url: serverUri.toString() });
120
+ const response = await (0, request_light_1.xhr)({ url: serverUri.toString() });
121
121
  if (response.status >= 200 && response.status <= 204) {
122
122
  content = entry.content = response.body;
123
123
  }