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

[vscode] stub continuous test runs API #12456

Merged
merged 1 commit into from
Apr 27, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/plugin-ext/src/plugin/stubs/tests-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export const createRunProfile = (
token: CancellationToken
) => Thenable<void> | void,
isDefault?: boolean,
tag?: theia.TestTag
tag?: theia.TestTag,
supportsContinuousRun?: boolean
) => ({
label,
kind,
isDefault: isDefault ?? false,
tag,
supportsContinuousRun: supportsContinuousRun ?? false,
runHandler,
configureHandler: undefined,
dispose: () => undefined,
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3115,6 +3115,7 @@ export class TestRunRequest implements theia.TestRunRequest {
public readonly include: theia.TestItem[] | undefined = undefined,
public readonly exclude: theia.TestItem[] | undefined = undefined,
public readonly profile: theia.TestRunProfile | undefined = undefined,
public readonly continuous: boolean | undefined = undefined,
) { }
}

Expand Down
25 changes: 23 additions & 2 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15572,6 +15572,14 @@ export interface TestRunProfile {
*/
isDefault: boolean;

/**
* Whether this profile supports continuous running of requests. If so,
* then {@link TestRunRequest.continuous} may be set to `true`. Defaults
* to false.
* @stubbed
*/
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 @@ -15594,6 +15602,11 @@ export interface TestRunProfile {
* 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 @@ -15653,11 +15666,12 @@ export interface TestController {
* @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.
* @stubbed
*/
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 @@ -15777,12 +15791,19 @@ export class TestRunRequest {
*/
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