visual-studio-code - How do I run integration tests for a vscode extension that depends on other extensions
问题描述
The vscode API documentation includes a page on how to test extensions. This works well when you have a single extension with no dependencies. However, in our case, we extensionDependencies
since our extension depends on hbenl.vscode-test-explorer
.
On our CI server, we have a problem that we cannot run the tests until this dependency is installed, but there is no API exposed by vscode's test API to install extensions.
We could download our own copy of vscode and use the --install-extension
command to install this dependency, but that complicates things since now we are managing the download that the API used to manage.
There are two reasonable possibilities that I would like to explore:
- How can I disable the
extensionDependencies
when activating my extension? - How can I download the dependency as part of the
vscode-test
run?
解决方案
不知何故,我在文档中错过了这一点。自定义设置vscode-test
。
代码在链接中可用,所以我不会全部复制。这是最相关的部分:
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable');
const cliPath = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath);
// Use cp.spawn / cp.exec for custom setup
cp.spawnSync(cliPath, ['--install-extension', '<EXTENSION-ID-OR-PATH-TO-VSIX>'], {
encoding: 'utf-8',
stdio: 'inherit'
});
推荐阅读
- python - 从 sklearn 数据集下载 MNIST 数据会出现超时错误
- windows - Electron 上 Windows 系统托盘“重音颜色覆盖”的侦听器
- python - Odoo 10:停止树视图中的创建按钮以打开表单视图
- docker - 当我使用 Dockerfile 构建映像时如何停止构建?
- javascript - React 派生组件不会在状态更改时更新
- android - kotlin(anko) 将主要活动中的数据解析为具有回收器视图的另一个活动[关闭]
- c# - HtmlAgilitypack 无法加载某些 html 代码。在 w3wp.exe 中导致未处理的 .net Framework 异常
- javascript - Angular 6:网址上显示的插座名称如何删除?
- angular - Angular CLI 错误:serve 命令需要在 Angular 项目中运行,但找不到项目定义
- python - Return bool if a string shares all characters with another string including doubles Python-3.x