testing: add refresh action

For #139737
This commit is contained in:
Connor Peet
2022-01-06 13:02:38 -08:00
parent 384cee8d17
commit a87cdeaec7
14 changed files with 215 additions and 28 deletions

View File

@@ -55,7 +55,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
/**
* Implements vscode.test.registerTestProvider
*/
public createTestController(controllerId: string, label: string): vscode.TestController {
public createTestController(controllerId: string, label: string, refreshHandler?: () => Thenable<void> | void): vscode.TestController {
if (this.controllers.has(controllerId)) {
throw new Error(`Attempt to insert a duplicate controller with ID "${controllerId}"`);
}
@@ -75,7 +75,14 @@ export class ExtHostTesting implements ExtHostTestingShape {
set label(value: string) {
label = value;
collection.root.label = value;
proxy.$updateControllerLabel(controllerId, label);
proxy.$updateController(controllerId, { label });
},
get refreshHandler() {
return refreshHandler;
},
set refreshHandler(value: (() => Thenable<void> | void) | undefined) {
refreshHandler = value;
proxy.$updateController(controllerId, { canRefresh: !!value });
},
get id() {
return controllerId;
@@ -109,10 +116,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
},
};
// back compat:
(controller as any).createRunConfiguration = controller.createRunProfile;
proxy.$registerTestController(controllerId, label);
proxy.$registerTestController(controllerId, label, !!refreshHandler);
disposable.add(toDisposable(() => proxy.$unregisterTestController(controllerId)));
const info: ControllerInfo = { controller, collection, profiles: profiles };
@@ -178,6 +182,11 @@ export class ExtHostTesting implements ExtHostTestingShape {
this.controllers.get(controllerId)?.profiles.get(profileId)?.configureHandler?.();
}
/** @inheritdoc */
async $refreshTests(controllerId: string) {
await this.controllers.get(controllerId)?.controller.refreshHandler?.();
}
/**
* Updates test results shown to extensions.
* @override