@@ -54,8 +54,8 @@ import { TestingObjectTree } from 'vs/workbench/contrib/testing/browser/explorer
5454import { ISerializedTestTreeCollapseState } from 'vs/workbench/contrib/testing/browser/explorerProjections/testingViewState' ;
5555import * as icons from 'vs/workbench/contrib/testing/browser/icons' ;
5656import { TestingExplorerFilter } from 'vs/workbench/contrib/testing/browser/testingExplorerFilter' ;
57- import { ITestingProgressUiService } from 'vs/workbench/contrib/testing/browser/testingProgressUiService' ;
58- import { TestingConfigKeys , getTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration' ;
57+ import { CountSummary , ITestingProgressUiService } from 'vs/workbench/contrib/testing/browser/testingProgressUiService' ;
58+ import { TestingConfigKeys , TestingCountBadge , getTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration' ;
5959import { TestCommandId , TestExplorerViewMode , TestExplorerViewSorting , Testing , labelForTestInState } from 'vs/workbench/contrib/testing/common/constants' ;
6060import { StoredValue } from 'vs/workbench/contrib/testing/common/storedValue' ;
6161import { ITestExplorerFilterState , TestExplorerFilterState , TestFilterTerm } from 'vs/workbench/contrib/testing/common/testExplorerFilterState' ;
@@ -70,6 +70,7 @@ import { ITestingPeekOpener } from 'vs/workbench/contrib/testing/common/testingP
7070import { cmpPriority , isFailedState , isStateWithResult } from 'vs/workbench/contrib/testing/common/testingStates' ;
7171import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
7272import { ITestingContinuousRunService } from 'vs/workbench/contrib/testing/common/testingContinuousRunService' ;
73+ import { IActivityService , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
7374
7475const enum LastFocusState {
7576 Input ,
@@ -81,8 +82,10 @@ export class TestingExplorerView extends ViewPane {
8182 private filterActionBar = this . _register ( new MutableDisposable ( ) ) ;
8283 private container ! : HTMLElement ;
8384 private treeHeader ! : HTMLElement ;
85+ private countSummary : CountSummary | undefined ;
8486 private discoveryProgress = this . _register ( new MutableDisposable < UnmanagedProgress > ( ) ) ;
8587 private readonly filter = this . _register ( new MutableDisposable < TestingExplorerFilter > ( ) ) ;
88+ private readonly badgeDisposable = this . _register ( new MutableDisposable < IDisposable > ( ) ) ;
8689 private readonly filterFocusListener = this . _register ( new MutableDisposable ( ) ) ;
8790 private readonly dimensions = { width : 0 , height : 0 } ;
8891 private lastFocusState = LastFocusState . Input ;
@@ -93,6 +96,7 @@ export class TestingExplorerView extends ViewPane {
9396
9497 constructor (
9598 options : IViewletViewOptions ,
99+ @IActivityService private readonly activityService : IActivityService ,
96100 @IContextMenuService contextMenuService : IContextMenuService ,
97101 @IKeybindingService keybindingService : IKeybindingService ,
98102 @IConfigurationService configurationService : IConfigurationService ,
@@ -121,6 +125,8 @@ export class TestingExplorerView extends ViewPane {
121125 } ) ) ;
122126
123127 this . _register ( testProfileService . onDidChange ( ( ) => this . updateActions ( ) ) ) ;
128+ const onDidChangeTestingCountBadge = Event . filter ( configurationService . onDidChangeConfiguration , e => e . affectsConfiguration ( 'testing.countBadge' ) ) ;
129+ this . _register ( onDidChangeTestingCountBadge ( this . renderActivityCount , this ) ) ;
124130 }
125131
126132 public override shouldShowWelcome ( ) {
@@ -269,6 +275,10 @@ export class TestingExplorerView extends ViewPane {
269275 this . layoutBody ( ) ;
270276 }
271277 } ) ) ;
278+ this . _register ( this . testProgressService . onCountChange ( ( text : CountSummary ) => {
279+ this . countSummary = text ;
280+ this . renderActivityCount ( ) ;
281+ } ) ) ;
272282
273283 const listContainer = dom . append ( this . container , dom . $ ( '.test-explorer-tree' ) ) ;
274284 this . viewModel = this . instantiationService . createInstance ( TestingExplorerViewModel , listContainer , this . onDidChangeBodyVisibility ) ;
@@ -417,6 +427,27 @@ export class TestingExplorerView extends ViewPane {
417427 }
418428 }
419429
430+ private renderActivityCount ( ) {
431+ const countBadgeType = this . configurationService . getValue < TestingCountBadge > ( TestingConfigKeys . CountBadge ) ;
432+ if ( ! this . countSummary || countBadgeType === TestingCountBadge . Off || this . countSummary [ countBadgeType ] === 0 ) {
433+ this . badgeDisposable . value = undefined ;
434+ } else {
435+ const badge = new NumberBadge ( this . countSummary [ countBadgeType ] , num => this . getLocalizedBadgeString ( countBadgeType , num ) ) ;
436+ this . badgeDisposable . value = this . activityService . showViewActivity ( Testing . ExplorerViewId , { badge } ) ;
437+ }
438+ }
439+
440+ private getLocalizedBadgeString ( countBadgeType : TestingCountBadge , count : number ) : string {
441+ switch ( countBadgeType ) {
442+ case TestingCountBadge . Passed :
443+ return localize ( 'testingCountBadgePassed' , '{0} passed tests' , count ) ;
444+ case TestingCountBadge . Skipped :
445+ return localize ( 'testingCountBadgeSkipped' , '{0} skipped tests' , count ) ;
446+ default :
447+ return localize ( 'testingCountBadgeFailed' , '{0} failed tests' , count ) ;
448+ }
449+ }
450+
420451 /**
421452 * @override
422453 */
0 commit comments