Skip to content

testing: add new API sortText property to TestItem#132099

Merged
connor4312 merged 1 commit intomicrosoft:mainfrom
smcenlly:issue-130882
Jan 24, 2022
Merged

testing: add new API sortText property to TestItem#132099
connor4312 merged 1 commit intomicrosoft:mainfrom
smcenlly:issue-130882

Conversation

@smcenlly
Copy link
Contributor

@smcenlly smcenlly commented Sep 2, 2021

testing: add new API sortText property to TestItem; if populated will be used instead of label for sorting items in Test Explorer tree and list view

This PR fixes #130882.

This repo may be used for testing: https://github.com/smcenlly/vscode-issue-130883. Change sortText and label to confirm sortText is being used instead of label when sortText exists.

./src/extension.ts

import * as vscode from 'vscode';

export async function activate(context: vscode.ExtensionContext) {
  const ctrl = vscode.tests.createTestController('duration-bug', 'duration-bug');
  const parent = ctrl.createTestItem('TestParent', 'Test Parent');
  const testItem1 = ctrl.createTestItem('A', 'A');
  const testItem2 = ctrl.createTestItem('B', 'B');
  (testItem1 as any).sortText = 'B';
  (testItem2 as any).sortText = 'A';
  parent.children.add(testItem1);
  parent.children.add(testItem2);
  ctrl.items.add(parent);
  context.subscriptions.push(ctrl);
}

…ll be used instead of `label` for sorting items in Test Explorer tree and list view
@connor4312 connor4312 merged commit 8aee3a2 into microsoft:main Jan 24, 2022
@connor4312 connor4312 added this to the January 2022 milestone Jan 24, 2022
@smcenlly smcenlly deleted the issue-130882 branch January 25, 2022 00:31
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test UI: Provide a mechanism to control sort order other than by label

2 participants