diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 56c153e33ae..146c977a3b5 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2286,7 +2286,7 @@ declare module 'vscode' { export function createDocumentTestObserver(document: TextDocument): TestObserver; /** - * Creates a {@link TestRunTask}. This should be called by the + * Creates a {@link TestRun}. This should be called by the * {@link TestRunner} when a request is made to execute tests, and may also * be called if a test run is detected externally. Once created, tests * that are included in the results will be moved into the @@ -2301,7 +2301,7 @@ declare module 'vscode' { * persisted in VS Code. This may be false if the results are coming from * a file already saved externally, such as a coverage information file. */ - export function createTestRunTask(request: TestRunRequest, name?: string, persist?: boolean): TestRunTask; + export function createTestRun(request: TestRunRequest, name?: string, persist?: boolean): TestRun; /** * Creates a new managed {@link TestItem} instance. @@ -2422,7 +2422,7 @@ declare module 'vscode' { /** * Starts a test run. When called, the controller should call - * {@link vscode.test.createTestRunTask}. All tasks associated with the + * {@link vscode.test.createTestRun}. All tasks associated with the * run should be created before the function returns or the reutrned * promise is resolved. * @@ -2459,7 +2459,7 @@ declare module 'vscode' { /** * Options given to {@link TestController.runTests} */ - export interface TestRunTask { + export interface TestRun { /** * The human-readable name of the run. This can be used to * disambiguate multiple sets of results in a test run. It is useful if diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 1bfd345a466..14757bf88e9 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -356,9 +356,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I createTestItem(options: vscode.TestItemOptions, data?: T) { return new extHostTypes.TestItemImpl(options.id, options.label, options.uri, data); }, - createTestRunTask(request, name, persist) { + createTestRun(request, name, persist) { checkProposedApiEnabled(extension); - return extHostTesting.createTestRunTask(extension.identifier.value, request, name, persist); + return extHostTesting.createTestRun(extension.identifier.value, request, name, persist); }, get onDidChangeTestResults() { checkProposedApiEnabled(extension); @@ -370,6 +370,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I }, }; + // todo@connor4312: backwards compatibility for a short period + (test as any).createTestRunTask = test.createTestRun; + // namespace: extensions const extensions: typeof vscode.extensions = { getExtension(extensionId: string): vscode.Extension | undefined { diff --git a/src/vs/workbench/api/common/extHostTesting.ts b/src/vs/workbench/api/common/extHostTesting.ts index c90ffb0dece..7afd44dfc34 100644 --- a/src/vs/workbench/api/common/extHostTesting.ts +++ b/src/vs/workbench/api/common/extHostTesting.ts @@ -111,10 +111,10 @@ export class ExtHostTesting implements ExtHostTestingShape { } /** - * Implements vscode.test.createTestRunTask + * Implements vscode.test.createTestRun */ - public createTestRunTask(extensionId: string, request: vscode.TestRunRequest, name: string | undefined, persist = true): vscode.TestRunTask { - return this.runQueue.createTestRunTask(extensionId, request, name, persist); + public createTestRun(extensionId: string, request: vscode.TestRunRequest, name: string | undefined, persist = true): vscode.TestRun { + return this.runQueue.createTestRun(extensionId, request, name, persist); } /** @@ -318,7 +318,7 @@ export class ExtHostTesting implements ExtHostTestingShape { /** * Queues runs for a single extension and provides the currently-executing - * run so that `createTestRunTask` can be properly correlated. + * run so that `createTestRun` can be properly correlated. */ class TestRunQueue { private readonly state = new Map(extensionId: string, request: vscode.TestRunRequest, name: string | undefined, persist: boolean): vscode.TestRunTask { + public createTestRun(extensionId: string, request: vscode.TestRunRequest, name: string | undefined, persist: boolean): vscode.TestRun { const state = this.state.get(extensionId); // If the request is for the currently-executing `runTests`, then correlate // it to that existing run. Otherwise return a new, detached run. @@ -466,7 +466,7 @@ class TestRunDto { } } -class TestRunTask implements vscode.TestRunTask { +class TestRunTask implements vscode.TestRun { readonly #proxy: MainThreadTestingShape; readonly #req: TestRunDto; readonly #taskId = generateUuid();