This commit is contained in:
Connor Peet 2021-10-01 19:25:34 -07:00
Родитель 24e3aa4fe0
Коммит e6cf323bc1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CF8FD2EA0DBC61BD
3 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -173,11 +173,11 @@ function runHandler(shouldDebug: boolean, request: vscode.TestRunRequest, token:
// todo
}
controller.createRunProfile('Run', vscode.TestRunProfileKind.Run, (request, token) => {
const runProfile = controller.createRunProfile('Run', vscode.TestRunProfileKind.Run, (request, token) => {
runHandler(false, request, token);
});
controller.createRunProfile('Debug', vscode.TestRunProfileKind.Debug, (request, token) => {
const debugProfile = controller.createRunProfile('Debug', vscode.TestRunProfileKind.Debug, (request, token) => {
runHandler(true, request, token);
});
```
@ -239,6 +239,25 @@ In addition to the `runHandler`, you can set a `configureHandler` on the `TestRu
> VS Code intentionally handles test configuration differently than debug or task configuration. These are traditionally editor or IDE-centric features, and are configured in special files in the `.vscode` folder. However, tests have traditionally been executed from the command line, and most test frameworks have existing configuration strategies. Therefore, in VS Code, we avoid duplication of configuration and instead leave it up to extensions to handle.
#### Test Tags
Sometime tests can only be run under certain configurations, or not at all. For these use cases, you can use Test Tags. `TestRunProfile`s can optionally have a tag associated with them and, if they do, only tests that have that tag can be run under the profile. Once again, if there is no eligible profile to run, debug, or gather coverage from a specific test, those options will not be shown in the UI.
```ts
// Create a new tag with an ID of "runnable"
const runnableTag = new TestTag('runnable');
// Assign it to a profile. Now this profile can only execute tests with that tag.
runProfile.tag = runnableTag;
// Add the "runnable" tag to all applicable tests.
for (const test of getAllRunnableTests()) {
test.tags = [...test.tags, runnableTag];
}
```
Users can also filter by tags in the Test Explorer UI.
### Publish-only controllers
The presence of run profiles is optional. A controller is allowed to create tests, call `createTestRun` outside of the `runHandler`, and update tests' states in the run without having a profile. The common use case for this are controllers who load their results from an external source, like CI or summary files.

Просмотреть файл

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d26ba985ecf94dc3a76f310b41fd7381da7d0e30ce8d7b753527de3d8f408814
size 78402

Просмотреть файл

@ -235,6 +235,12 @@ Features of the library include:
* **Use any tech stack:** The library ships as a set of web components, meaning developers can use the toolkit no matter what tech stack (React, Vue, Svelte, etc.) their extension is built with.
* **Accessible out of the box:** All components ship with web standard compliant ARIA labels and keyboard navigation.
### Test Tags and Non-Error Output
This month we shipped additional APIs for extensions building on the new [testing APIs](api/extension-guides/testing.md). [Test tags](https://github.com/microsoft/vscode/issues/129456) allow you configure if and how certain tests can be run--or not. [Non-error output](https://github.com/microsoft/vscode/issues/129201#issuecomment-897178325) allows you to associate additional console output with specific test cases. Messages from the output are displayed inline, similarly to failure messages.
![Image showing "hello world" displayed inline beside a console.log statement](images/1_61/non-error-test-output.png)
### Platform-specific extensions
Extensions can now publish different VSIXs for each platform (Windows, Linux, macOS) VS Code is running on. We call such extensions **platform-specific extensions**. Starting with version 1.61.0, VS Code looks for the extension package that matches the current platform.