@@ -10,10 +10,11 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe
1010import { NullLogService } from 'vs/platform/log/common/log' ;
1111import { TestId } from 'vs/workbench/contrib/testing/common/testId' ;
1212import { TestProfileService } from 'vs/workbench/contrib/testing/common/testProfileService' ;
13- import { HydratedTestResult , LiveTestResult , makeEmptyCounts , resultItemParents , TaskRawOutput , TestResultItemChange , TestResultItemChangeReason } from 'vs/workbench/contrib/testing/common/testResult' ;
13+ import { HydratedTestResult , LiveTestResult , resultItemParents , TaskRawOutput , TestResultItemChange , TestResultItemChangeReason } from 'vs/workbench/contrib/testing/common/testResult' ;
1414import { TestResultService } from 'vs/workbench/contrib/testing/common/testResultService' ;
1515import { InMemoryResultStorage , ITestResultStorage } from 'vs/workbench/contrib/testing/common/testResultStorage' ;
1616import { ITestTaskState , ResolvedTestRunRequest , TestResultItem , TestResultState , TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes' ;
17+ import { makeEmptyCounts } from 'vs/workbench/contrib/testing/common/testingStates' ;
1718import { getInitializedMainTestCollection , testStubs , TestTestCollection } from 'vs/workbench/contrib/testing/test/common/testStubs' ;
1819import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices' ;
1920
@@ -93,27 +94,24 @@ suite('Workbench - Test Results Service', () => {
9394 } ) ;
9495
9596 test ( 'initializes with valid counts' , ( ) => {
96- assert . deepStrictEqual ( r . counts , {
97- ...makeEmptyCounts ( ) ,
98- [ TestResultState . Unset ] : 4 ,
99- } ) ;
97+ const c = makeEmptyCounts ( ) ;
98+ c [ TestResultState . Unset ] = 4 ;
99+ assert . deepStrictEqual ( r . counts , c ) ;
100100 } ) ;
101101
102102 test ( 'setAllToState' , ( ) => {
103103 changed . clear ( ) ;
104104 r . setAllToStatePublic ( TestResultState . Queued , 't' , ( _ , t ) => t . item . label !== 'root' ) ;
105- assert . deepStrictEqual ( r . counts , {
106- ...makeEmptyCounts ( ) ,
107- [ TestResultState . Unset ] : 1 ,
108- [ TestResultState . Queued ] : 3 ,
109- } ) ;
105+ const c = makeEmptyCounts ( ) ;
106+ c [ TestResultState . Unset ] = 1 ;
107+ c [ TestResultState . Queued ] = 3 ;
108+ assert . deepStrictEqual ( r . counts , c ) ;
110109
111110 r . setAllToStatePublic ( TestResultState . Failed , 't' , ( _ , t ) => t . item . label !== 'root' ) ;
112- assert . deepStrictEqual ( r . counts , {
113- ...makeEmptyCounts ( ) ,
114- [ TestResultState . Unset ] : 1 ,
115- [ TestResultState . Failed ] : 3 ,
116- } ) ;
111+ const c2 = makeEmptyCounts ( ) ;
112+ c2 [ TestResultState . Unset ] = 1 ;
113+ c2 [ TestResultState . Failed ] = 3 ;
114+ assert . deepStrictEqual ( r . counts , c2 ) ;
117115
118116 assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-a' ] ) . toString ( ) ) ?. ownComputedState , TestResultState . Failed ) ;
119117 assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-a' ] ) . toString ( ) ) ?. tasks [ 0 ] . state , TestResultState . Failed ) ;
@@ -134,11 +132,10 @@ suite('Workbench - Test Results Service', () => {
134132 changed . clear ( ) ;
135133 const testId = new TestId ( [ 'ctrlId' , 'id-a' , 'id-aa' ] ) . toString ( ) ;
136134 r . updateState ( testId , 't' , TestResultState . Running ) ;
137- assert . deepStrictEqual ( r . counts , {
138- ...makeEmptyCounts ( ) ,
139- [ TestResultState . Unset ] : 3 ,
140- [ TestResultState . Running ] : 1 ,
141- } ) ;
135+ const c = makeEmptyCounts ( ) ;
136+ c [ TestResultState . Running ] = 1 ;
137+ c [ TestResultState . Unset ] = 3 ;
138+ assert . deepStrictEqual ( r . counts , c ) ;
142139 assert . deepStrictEqual ( r . getStateById ( testId ) ?. ownComputedState , TestResultState . Running ) ;
143140 // update computed state:
144141 assert . deepStrictEqual ( r . getStateById ( tests . root . id ) ?. computedState , TestResultState . Running ) ;
@@ -161,10 +158,9 @@ suite('Workbench - Test Results Service', () => {
161158 test ( 'ignores outside run' , ( ) => {
162159 changed . clear ( ) ;
163160 r . updateState ( new TestId ( [ 'ctrlId' , 'id-b' ] ) . toString ( ) , 't' , TestResultState . Running ) ;
164- assert . deepStrictEqual ( r . counts , {
165- ...makeEmptyCounts ( ) ,
166- [ TestResultState . Unset ] : 4 ,
167- } ) ;
161+ const c = makeEmptyCounts ( ) ;
162+ c [ TestResultState . Unset ] = 4 ;
163+ assert . deepStrictEqual ( r . counts , c ) ;
168164 assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-b' ] ) . toString ( ) ) , undefined ) ;
169165 } ) ;
170166
@@ -175,11 +171,10 @@ suite('Workbench - Test Results Service', () => {
175171
176172 r . markComplete ( ) ;
177173
178- assert . deepStrictEqual ( r . counts , {
179- ...makeEmptyCounts ( ) ,
180- [ TestResultState . Passed ] : 1 ,
181- [ TestResultState . Unset ] : 3 ,
182- } ) ;
174+ const c = makeEmptyCounts ( ) ;
175+ c [ TestResultState . Unset ] = 3 ;
176+ c [ TestResultState . Passed ] = 1 ;
177+ assert . deepStrictEqual ( r . counts , c ) ;
183178
184179 assert . deepStrictEqual ( r . getStateById ( tests . root . id ) ?. ownComputedState , TestResultState . Unset ) ;
185180 assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-a' , 'id-aa' ] ) . toString ( ) ) ?. ownComputedState , TestResultState . Passed ) ;
0 commit comments