Skip to content

Commit 3b53204

Browse files
authored
testing: remove old test output terminal (microsoft#185405)
Remove the old "test output terminal" stuff now that we use real terminals for showing output in the Test Results view. Move the "Show Output" buttons to reveal the Test Results view instead of opening the terminal. Closes microsoft#151964
1 parent eb69cf5 commit 3b53204

File tree

4 files changed

+31
-347
lines changed

4 files changed

+31
-347
lines changed

src/vs/workbench/contrib/testing/browser/testExplorerActions.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { VIEWLET_ID as EXTENSIONS_VIEWLET_ID, IExtensionsViewPaneContainer } fro
3131
import { IActionableTestTreeElement, TestExplorerTreeElement, TestItemTreeElement } from 'vs/workbench/contrib/testing/browser/explorerProjections/index';
3232
import * as icons from 'vs/workbench/contrib/testing/browser/icons';
3333
import { TestingExplorerView } from 'vs/workbench/contrib/testing/browser/testingExplorerView';
34-
import { ITestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
34+
import { TestResultsView } from 'vs/workbench/contrib/testing/browser/testingOutputPeek';
3535
import { TestingConfigKeys, getTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
3636
import { TestCommandId, TestExplorerViewMode, TestExplorerViewSorting, Testing, testConfigurationGroupNames } from 'vs/workbench/contrib/testing/common/constants';
3737
import { TestId } from 'vs/workbench/contrib/testing/common/testId';
@@ -840,30 +840,9 @@ export class ShowMostRecentOutputAction extends Action2 {
840840
}
841841

842842
public async run(accessor: ServicesAccessor) {
843-
const quickInputService = accessor.get(IQuickInputService);
844-
const terminalOutputService = accessor.get(ITestingOutputTerminalService);
845-
const result = accessor.get(ITestResultService).results[0];
846-
847-
if (!result.tasks.length) {
848-
return;
849-
}
850-
851-
let index = 0;
852-
if (result.tasks.length > 1) {
853-
const picked = await quickInputService.pick(
854-
result.tasks.map((t, i) => ({ label: t.name || localize('testing.pickTaskUnnamed', "Run #{0}", i), index: i })),
855-
{ placeHolder: localize('testing.pickTask', "Pick a run to show output for") }
856-
);
857-
858-
if (!picked) {
859-
return;
860-
}
861-
862-
index = picked.index;
863-
}
864-
865-
866-
terminalOutputService.open(result, index);
843+
const viewService = accessor.get(IViewsService);
844+
const testView = await viewService.openView<TestResultsView>(Testing.ResultsViewId, true);
845+
testView?.showLatestRun();
867846
}
868847
}
869848

src/vs/workbench/contrib/testing/browser/testing.contribution.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,41 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
1616
import { IOpenerService } from 'vs/platform/opener/common/opener';
1717
import { IProgressService } from 'vs/platform/progress/common/progress';
1818
import { Registry } from 'vs/platform/registry/common/platform';
19-
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
20-
import { Extensions as ViewContainerExtensions, IViewContainersRegistry, IViewsRegistry, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
19+
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
20+
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
21+
import { IViewContainersRegistry, IViewsRegistry, IViewsService, Extensions as ViewContainerExtensions, ViewContainerLocation } from 'vs/workbench/common/views';
2122
import { REVEAL_IN_EXPLORER_COMMAND_ID } from 'vs/workbench/contrib/files/browser/fileConstants';
2223
import { testingResultsIcon, testingViewIcon } from 'vs/workbench/contrib/testing/browser/icons';
23-
import { TestingDecorations, TestingDecorationService } from 'vs/workbench/contrib/testing/browser/testingDecorations';
24+
import { TestingDecorationService, TestingDecorations } from 'vs/workbench/contrib/testing/browser/testingDecorations';
2425
import { TestingExplorerView } from 'vs/workbench/contrib/testing/browser/testingExplorerView';
2526
import { CloseTestPeek, GoToNextMessageAction, GoToPreviousMessageAction, OpenMessageInEditorAction, TestResultsView, TestingOutputPeekController, TestingPeekOpener, ToggleTestingPeekHistory } from 'vs/workbench/contrib/testing/browser/testingOutputPeek';
26-
import { ITestingOutputTerminalService, TestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
2727
import { ITestingProgressUiService, TestingProgressTrigger, TestingProgressUiService } from 'vs/workbench/contrib/testing/browser/testingProgressUiService';
2828
import { TestingViewPaneContainer } from 'vs/workbench/contrib/testing/browser/testingViewPaneContainer';
2929
import { testingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
3030
import { TestCommandId, Testing } from 'vs/workbench/contrib/testing/common/constants';
31-
import { ITestItem, TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes';
3231
import { ITestExplorerFilterState, TestExplorerFilterState } from 'vs/workbench/contrib/testing/common/testExplorerFilterState';
3332
import { TestId, TestPosition } from 'vs/workbench/contrib/testing/common/testId';
34-
import { TestingContentProvider } from 'vs/workbench/contrib/testing/common/testingContentProvider';
35-
import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys';
36-
import { ITestingDecorationsService } from 'vs/workbench/contrib/testing/common/testingDecorations';
37-
import { ITestingPeekOpener } from 'vs/workbench/contrib/testing/common/testingPeekOpener';
3833
import { ITestProfileService, TestProfileService } from 'vs/workbench/contrib/testing/common/testProfileService';
3934
import { ITestResultService, TestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
4035
import { ITestResultStorage, TestResultStorage } from 'vs/workbench/contrib/testing/common/testResultStorage';
4136
import { ITestService } from 'vs/workbench/contrib/testing/common/testService';
4237
import { TestService } from 'vs/workbench/contrib/testing/common/testServiceImpl';
38+
import { ITestItem, TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes';
39+
import { TestingContentProvider } from 'vs/workbench/contrib/testing/common/testingContentProvider';
40+
import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys';
41+
import { ITestingContinuousRunService, TestingContinuousRunService } from 'vs/workbench/contrib/testing/common/testingContinuousRunService';
42+
import { ITestingDecorationsService } from 'vs/workbench/contrib/testing/common/testingDecorations';
43+
import { ITestingPeekOpener } from 'vs/workbench/contrib/testing/common/testingPeekOpener';
4344
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
4445
import { allTestActions, discoverAndRunTests } from './testExplorerActions';
4546
import './testingConfigurationUi';
46-
import { ITestingContinuousRunService, TestingContinuousRunService } from 'vs/workbench/contrib/testing/common/testingContinuousRunService';
47-
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
4847

4948
registerSingleton(ITestService, TestService, InstantiationType.Delayed);
5049
registerSingleton(ITestResultStorage, TestResultStorage, InstantiationType.Delayed);
5150
registerSingleton(ITestProfileService, TestProfileService, InstantiationType.Delayed);
5251
registerSingleton(ITestingContinuousRunService, TestingContinuousRunService, InstantiationType.Delayed);
5352
registerSingleton(ITestResultService, TestResultService, InstantiationType.Delayed);
5453
registerSingleton(ITestExplorerFilterState, TestExplorerFilterState, InstantiationType.Delayed);
55-
registerSingleton(ITestingOutputTerminalService, TestingOutputTerminalService, InstantiationType.Delayed);
5654
registerSingleton(ITestingPeekOpener, TestingPeekOpener, InstantiationType.Delayed);
5755
registerSingleton(ITestingProgressUiService, TestingProgressUiService, InstantiationType.Delayed);
5856
registerSingleton(ITestingDecorationsService, TestingDecorationService, InstantiationType.Delayed);

src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import { TERMINAL_BACKGROUND_COLOR } from 'vs/workbench/contrib/terminal/common/
7575
import { flatTestItemDelimiter } from 'vs/workbench/contrib/testing/browser/explorerProjections/display';
7676
import { getTestItemContextOverlay } from 'vs/workbench/contrib/testing/browser/explorerProjections/testItemContextOverlay';
7777
import * as icons from 'vs/workbench/contrib/testing/browser/icons';
78-
import { ITestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
7978
import { testingPeekBorder, testingPeekHeaderBackground } from 'vs/workbench/contrib/testing/browser/theme';
8079
import { AutoOpenPeekViewWhen, TestingConfigKeys, getTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
8180
import { Testing } from 'vs/workbench/contrib/testing/common/constants';
@@ -945,6 +944,18 @@ export class TestResultsView extends ViewPane {
945944
return this.content.current;
946945
}
947946

947+
public showLatestRun(preserveFocus = false) {
948+
const result = this.resultService.results.find(r => r.tasks.length);
949+
if (!result) {
950+
return;
951+
}
952+
953+
this.content.reveal({
954+
preserveFocus,
955+
subject: new TaskSubject(result.id, 0),
956+
});
957+
}
958+
948959
protected override renderBody(container: HTMLElement): void {
949960
super.renderBody(container);
950961
this.content.fillBody(container);
@@ -1517,7 +1528,7 @@ class OutputPeekTree extends Disposable {
15171528
) {
15181529
super();
15191530

1520-
this.treeActions = instantiationService.createInstance(TreeActionsProvider, options.showRevealLocationOnMessages);
1531+
this.treeActions = instantiationService.createInstance(TreeActionsProvider, options.showRevealLocationOnMessages, this.requestReveal,);
15211532
const diffIdentityProvider: IIdentityProvider<TreeElement> = {
15221533
getId(e: TreeElement) {
15231534
return e.id;
@@ -1718,9 +1729,7 @@ class OutputPeekTree extends Disposable {
17181729
}));
17191730

17201731
this._register(this.tree.onDidOpen(async e => {
1721-
if (e.element instanceof TaskElement) {
1722-
this.requestReveal.fire(new TaskSubject(e.element.results.id, e.element.index));
1723-
} else if (e.element instanceof TestMessageElement) {
1732+
if (e.element instanceof TestMessageElement) {
17241733
this.requestReveal.fire(new MessageSubject(e.element.result.id, e.element.test, e.element.taskIndex, e.element.messageIndex));
17251734
}
17261735
}));
@@ -1852,8 +1861,8 @@ class TestRunElementRenderer implements ICompressibleTreeRenderer<ITreeElement,
18521861
class TreeActionsProvider {
18531862
constructor(
18541863
private readonly showRevealLocationOnMessages: boolean,
1864+
private readonly requestReveal: Emitter<InspectSubject>,
18551865
@IContextKeyService private readonly contextKeyService: IContextKeyService,
1856-
@ITestingOutputTerminalService private readonly testTerminalService: ITestingOutputTerminalService,
18571866
@IMenuService private readonly menuService: IMenuService,
18581867
@ICommandService private readonly commandService: ICommandService,
18591868
@ITestProfileService private readonly testProfileService: ITestProfileService,
@@ -1880,7 +1889,7 @@ class TreeActionsProvider {
18801889
localize('testing.showResultOutput', "Show Result Output"),
18811890
ThemeIcon.asClassName(Codicon.terminal),
18821891
undefined,
1883-
() => this.testTerminalService.open(element.results, element.index)
1892+
() => this.requestReveal.fire(new TaskSubject(element.results.id, element.index)),
18841893
));
18851894
}
18861895

@@ -1892,7 +1901,7 @@ class TreeActionsProvider {
18921901
localize('testing.showResultOutput', "Show Result Output"),
18931902
ThemeIcon.asClassName(Codicon.terminal),
18941903
undefined,
1895-
() => this.testTerminalService.open(element.value, 0)
1904+
() => this.requestReveal.fire(new TaskSubject(element.value.id, 0)),
18961905
));
18971906
}
18981907

@@ -1970,15 +1979,6 @@ class TreeActionsProvider {
19701979
}),
19711980
));
19721981
}
1973-
if (element.marker !== undefined) {
1974-
primary.push(new Action(
1975-
'testing.outputPeek.showMessageInTerminal',
1976-
localize('testing.showMessageInTerminal', "Show Output in Terminal"),
1977-
ThemeIcon.asClassName(Codicon.terminal),
1978-
undefined,
1979-
() => this.testTerminalService.open(element.result, element.taskIndex, element.marker),
1980-
));
1981-
}
19821982
}
19831983

19841984
const result = { primary, secondary };

0 commit comments

Comments
 (0)