testing: exploratory UI for followup actions

This adds an API that extensions can use to contribute 'followup'
actions around test messages. Here just a dummy hello world using
copilot, but extensions could have any action here, such as actions to
update snapshots if a test failed:

![](https://memes.peet.io/img/24-05-c1f3e073-a2da-4f16-a033-c8f7e5cd4864.png)

Implemented using a simple provider API.
This commit is contained in:
Connor Peet
2024-05-21 16:09:08 -07:00
parent 71e25d9b3c
commit e1dfc911ce
12 changed files with 315 additions and 34 deletions

View File

@@ -15,6 +15,11 @@ declare module 'vscode' {
*/
export function runTests(run: TestRunRequest, token?: CancellationToken): Thenable<void>;
/**
* Registers a provider that can provide follow-up actions for a test failure.
*/
export function registerTestFollowupProvider(provider: TestFollowupProvider): Disposable;
/**
* Returns an observer that watches and can request tests.
*/
@@ -31,6 +36,10 @@ declare module 'vscode' {
export const onDidChangeTestResults: Event<void>;
}
export interface TestFollowupProvider {
provideFollowup(result: TestRunResult, test: TestResultSnapshot, taskIndex: number, messageIndex: number, token: CancellationToken): ProviderResult<Command[]>;
}
export interface TestObserver {
/**
* List of tests returned by test provider for files in the workspace.