Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: finalize continuous run api #176454

Merged
merged 1 commit into from Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/vs/workbench/api/common/extHostTesting.ts
Expand Up @@ -22,11 +22,10 @@ import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocum
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { ExtHostTestItemCollection, TestItemImpl, TestItemRootImpl, toItemFromContext } from 'vs/workbench/api/common/extHostTestItem';
import * as Convert from 'vs/workbench/api/common/extHostTypeConverters';
import { TestRunProfileKind, TestRunRequest2 } from 'vs/workbench/api/common/extHostTypes';
import { TestRunProfileKind, TestRunRequest } from 'vs/workbench/api/common/extHostTypes';
import { TestId, TestIdPathParts, TestPosition } from 'vs/workbench/contrib/testing/common/testId';
import { InvalidTestItemError } from 'vs/workbench/contrib/testing/common/testItemCollection';
import { AbstractIncrementalTestCollection, CoverageDetails, ICallProfileRunHandler, IFileCoverage, ISerializedTestResults, IStartControllerTests, IStartControllerTestsResult, ITestItem, ITestItemContext, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, TestResultState, TestRunProfileBitset, TestsDiff, TestsDiffOp, isStartControllerTests } from 'vs/workbench/contrib/testing/common/testTypes';
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
import type * as vscode from 'vscode';

interface ControllerInfo {
Expand Down Expand Up @@ -111,10 +110,6 @@ export class ExtHostTesting implements ExtHostTestingShape {
profileId++;
}

if (supportsContinuousRun !== undefined) {
checkProposedApiEnabled(extension, 'testContinuousRun');
}

return new TestRunProfileImpl(this.proxy, profiles, controllerId, profileId, label, group, runHandler, isDefault, tag, supportsContinuousRun);
},
createTestItem(id, label, uri) {
Expand Down Expand Up @@ -307,7 +302,7 @@ export class ExtHostTesting implements ExtHostTestingShape {
return {};
}

const publicReq = new TestRunRequest2(
const publicReq = new TestRunRequest(
includeTests.some(i => i.actual instanceof TestItemRootImpl) ? undefined : includeTests.map(t => t.actual),
excludeTests.map(t => t.actual),
profile,
Expand Down Expand Up @@ -611,7 +606,7 @@ export class TestRunCoordinator {
/**
* Implements the public `createTestRun` API.
*/
public createTestRun(controllerId: string, collection: ExtHostTestItemCollection, request: vscode.TestRunRequest2, name: string | undefined, persist: boolean): vscode.TestRun {
public createTestRun(controllerId: string, collection: ExtHostTestItemCollection, request: vscode.TestRunRequest, name: string | undefined, persist: boolean): vscode.TestRun {
const existing = this.tracked.get(request);
if (existing) {
return existing.createRun(name);
Expand Down
13 changes: 3 additions & 10 deletions src/vs/workbench/api/common/extHostTypes.ts
Expand Up @@ -3766,20 +3766,13 @@ export class TestRunRequest implements vscode.TestRunRequest {
public readonly include: vscode.TestItem[] | undefined = undefined,
public readonly exclude: vscode.TestItem[] | undefined = undefined,
public readonly profile: vscode.TestRunProfile | undefined = undefined,
public readonly continuous = false,
) { }
}

/** Back-compat for proposed API users */
@es5ClassCompat
export class TestRunRequest2 extends TestRunRequest implements vscode.TestRunRequest2 {
constructor(
include: vscode.TestItem[] | undefined = undefined,
exclude: vscode.TestItem[] | undefined = undefined,
profile: vscode.TestRunProfile | undefined = undefined,
public readonly continuous = false,
) {
super(include, exclude, profile);
}
}
export class TestRunRequest2 extends TestRunRequest { }

@es5ClassCompat
export class TestMessage implements vscode.TestMessage {
Expand Down
Expand Up @@ -66,7 +66,6 @@ export const allApiProposals = Object.freeze({
terminalDataWriteEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts',
terminalDimensions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts',
terminalQuickFixProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts',
testContinuousRun: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testContinuousRun.d.ts',
testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts',
testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',
Expand Down
24 changes: 22 additions & 2 deletions src/vscode-dts/vscode.d.ts
Expand Up @@ -15946,6 +15946,13 @@ declare module 'vscode' {
*/
isDefault: boolean;

/**
* Whether this profile supports continuous running of requests. If so,
* then {@link TestRunRequest.continuous} may be set to `true`. Defaults
* to false.
*/
supportsContinuousRun: boolean;

/**
* Associated tag for the profile. If this is set, only {@link TestItem}
* instances with the same tag will be eligible to execute in this profile.
Expand All @@ -15966,6 +15973,11 @@ declare module 'vscode' {
* associated with the request should be created before the function returns
* or the returned promise is resolved.
*
* If {@link supportsContinuousRun} is set, then {@link TestRunRequest.continuous}
* may be `true`. In this case, the profile should observe changes to
* source code and create new test runs by calling {@link TestController.createTestRun},
* until the cancellation is requested on the `token`.
*
* @param request Request information for the test run.
* @param cancellationToken Token that signals the used asked to abort the
* test run. If cancellation is requested on this token, all {@link TestRun}
Expand Down Expand Up @@ -16020,10 +16032,11 @@ declare module 'vscode' {
* @param runHandler Function called to start a test run.
* @param isDefault Whether this is the default action for its kind.
* @param tag Profile test tag.
* @param supportsContinuousRun Whether the profile supports continuous running.
* @returns An instance of a {@link TestRunProfile}, which is automatically
* associated with this controller.
*/
createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable<void> | void, isDefault?: boolean, tag?: TestTag): TestRunProfile;
createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable<void> | void, isDefault?: boolean, tag?: TestTag, supportsContinuousRun?: boolean): TestRunProfile;

/**
* A function provided by the extension that the editor may call to request
Expand Down Expand Up @@ -16138,12 +16151,19 @@ declare module 'vscode' {
*/
readonly profile: TestRunProfile | undefined;

/**
* Whether the profile should run continuously as source code changes. Only
* relevant for profiles that set {@link TestRunProfile.supportsContinuousRun}.
*/
readonly continuous?: boolean;

/**
* @param include Array of specific tests to run, or undefined to run all tests
* @param exclude An array of tests to exclude from the run.
* @param profile The run profile used for this request.
* @param continuous Whether to run tests continuously as source changes.
*/
constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile);
constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean);
}

/**
Expand Down
66 changes: 0 additions & 66 deletions src/vscode-dts/vscode.proposed.testContinuousRun.d.ts

This file was deleted.