@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 +24 -18
- package/fs-provider/package.json +4 -4
- package/out/index.js +9 -1
- package/out/server/download.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# @vscode/test-web
|
|
2
2
|
|
|
3
|
-
This module helps testing
|
|
3
|
+
This module helps testing VS Code web extensions locally.
|
|
4
4
|
|
|
5
5
|
[](https://github.com/microsoft/vscode-test-web/actions/workflows/tests.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@vscode/test-web)
|
|
7
7
|
[](https://npmjs.org/package/@vscode/test-web)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
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
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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. |
|
package/fs-provider/package.json
CHANGED
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/vscode": "^1.55.0",
|
|
27
|
-
"@types/webpack-env": "^1.16.
|
|
28
|
-
"ts-loader": "^9.2.
|
|
29
|
-
"webpack": "^5.
|
|
30
|
-
"webpack-cli": "^4.
|
|
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');
|
package/out/server/download.js
CHANGED
|
@@ -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) {
|