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 TestRunRequest.preserveFocus API #212177

Merged
merged 1 commit into from
May 7, 2024
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
1 change: 0 additions & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
LinkedEditingRanges: extHostTypes.LinkedEditingRanges,
TestResultState: extHostTypes.TestResultState,
TestRunRequest: extHostTypes.TestRunRequest,
TestRunRequest2: extHostTypes.TestRunRequest,
TestMessage: extHostTypes.TestMessage,
TestTag: extHostTypes.TestTag,
TestRunProfileKind: extHostTypes.TestRunProfileKind,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/common/extHostTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class ExtHostTesting extends Disposable implements ExtHostTestingShape {
}

await this.proxy.$runTests({
preserveFocus: (req as vscode.TestRunRequest2).preserveFocus ?? true,
preserveFocus: req.preserveFocus ?? true,
targets: [{
testIds: req.include?.map(t => TestId.fromExtHostTestItem(t, controller.collection.root.id).toString()) ?? [controller.collection.root.id],
profileGroup: profileGroupToBitset[profile.kind],
Expand Down Expand Up @@ -746,7 +746,7 @@ export class TestRunCoordinator {
exclude: request.exclude?.map(t => TestId.fromExtHostTestItem(t, collection.root.id).toString()) ?? [],
id: dto.id,
include: request.include?.map(t => TestId.fromExtHostTestItem(t, collection.root.id).toString()) ?? [collection.root.id],
preserveFocus: (request as vscode.TestRunRequest2).preserveFocus ?? true,
preserveFocus: request.preserveFocus ?? true,
persist
});

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4023,7 +4023,7 @@ export enum TestRunProfileKind {
}

@es5ClassCompat
export class TestRunRequest implements vscode.TestRunRequest2 {
export class TestRunRequest implements vscode.TestRunRequest {
constructor(
public readonly include: vscode.TestItem[] | undefined = undefined,
public readonly exclude: vscode.TestItem[] | undefined = undefined,
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/api/test/browser/extHostTesting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ suite('ExtHost Testing', () => {
include: undefined,
exclude: [single.root.children.get('id-b')!],
profile: configuration,
preserveFocus: false,
};

dto = TestRunDto.fromInternal({
Expand Down Expand Up @@ -752,7 +753,7 @@ suite('ExtHost Testing', () => {
exclude: [new TestId(['ctrlId', 'id-b']).toString()],
persist: false,
continuous: false,
preserveFocus: true,
preserveFocus: false,
}]
]);

Expand Down Expand Up @@ -867,6 +868,7 @@ suite('ExtHost Testing', () => {
profile: configuration,
include: [single.root.children.get('id-a')!],
exclude: [single.root.children.get('id-a')!.children.get('id-aa')!],
preserveFocus: false,
}, 'hello world', false);

task.passed(single.root.children.get('id-a')!.children.get('id-aa')!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export const allApiProposals = Object.freeze({
terminalSelection: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts',
terminalShellIntegration: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts',
testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
testPreserveFocus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testPreserveFocus.d.ts',
textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',
timeline: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts',
tokenInformation: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts',
Expand Down
11 changes: 10 additions & 1 deletion src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17400,13 +17400,22 @@ declare module 'vscode' {
*/
readonly continuous?: boolean;

/**
* Controls how test Test Results view is focused. If true, the editor
* will keep the maintain the user's focus. If false, the editor will
* prefer to move focus into the Test Results view, although
* this may be configured by users.
*/
readonly preserveFocus: 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.
* @param preserveFocus Whether to preserve the user's focus when the run is started
*/
constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean);
constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean, preserveFocus?: boolean);
}

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

This file was deleted.

Loading