@@ -10,10 +10,11 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe
10
10
import { NullLogService } from 'vs/platform/log/common/log' ;
11
11
import { TestId } from 'vs/workbench/contrib/testing/common/testId' ;
12
12
import { 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' ;
14
14
import { TestResultService } from 'vs/workbench/contrib/testing/common/testResultService' ;
15
15
import { InMemoryResultStorage , ITestResultStorage } from 'vs/workbench/contrib/testing/common/testResultStorage' ;
16
16
import { ITestTaskState , ResolvedTestRunRequest , TestResultItem , TestResultState , TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes' ;
17
+ import { makeEmptyCounts } from 'vs/workbench/contrib/testing/common/testingStates' ;
17
18
import { getInitializedMainTestCollection , testStubs , TestTestCollection } from 'vs/workbench/contrib/testing/test/common/testStubs' ;
18
19
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices' ;
19
20
@@ -93,27 +94,24 @@ suite('Workbench - Test Results Service', () => {
93
94
} ) ;
94
95
95
96
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 ) ;
100
100
} ) ;
101
101
102
102
test ( 'setAllToState' , ( ) => {
103
103
changed . clear ( ) ;
104
104
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 ) ;
110
109
111
110
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 ) ;
117
115
118
116
assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-a' ] ) . toString ( ) ) ?. ownComputedState , TestResultState . Failed ) ;
119
117
assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-a' ] ) . toString ( ) ) ?. tasks [ 0 ] . state , TestResultState . Failed ) ;
@@ -134,11 +132,10 @@ suite('Workbench - Test Results Service', () => {
134
132
changed . clear ( ) ;
135
133
const testId = new TestId ( [ 'ctrlId' , 'id-a' , 'id-aa' ] ) . toString ( ) ;
136
134
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 ) ;
142
139
assert . deepStrictEqual ( r . getStateById ( testId ) ?. ownComputedState , TestResultState . Running ) ;
143
140
// update computed state:
144
141
assert . deepStrictEqual ( r . getStateById ( tests . root . id ) ?. computedState , TestResultState . Running ) ;
@@ -161,10 +158,9 @@ suite('Workbench - Test Results Service', () => {
161
158
test ( 'ignores outside run' , ( ) => {
162
159
changed . clear ( ) ;
163
160
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 ) ;
168
164
assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-b' ] ) . toString ( ) ) , undefined ) ;
169
165
} ) ;
170
166
@@ -175,11 +171,10 @@ suite('Workbench - Test Results Service', () => {
175
171
176
172
r . markComplete ( ) ;
177
173
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 ) ;
183
178
184
179
assert . deepStrictEqual ( r . getStateById ( tests . root . id ) ?. ownComputedState , TestResultState . Unset ) ;
185
180
assert . deepStrictEqual ( r . getStateById ( new TestId ( [ 'ctrlId' , 'id-a' , 'id-aa' ] ) . toString ( ) ) ?. ownComputedState , TestResultState . Passed ) ;
0 commit comments