@@ -46,8 +46,8 @@ export async function setupHistoryExplorerController() {
46
46
}
47
47
}
48
48
49
- export function serverSpecForUri ( uri : vscode . Uri ) : IServerSpec | undefined {
50
- const server = osAPI . serverForUri ( uri ) ;
49
+ export async function serverSpecForUri ( uri : vscode . Uri ) : Promise < IServerSpec | undefined > {
50
+ const server = await osAPI . asyncServerForUri ( uri ) ;
51
51
if ( server ) {
52
52
return {
53
53
username : server . username ,
@@ -70,7 +70,7 @@ export async function serverSpec(item: vscode.TestItem): Promise<IServerSpec | u
70
70
if ( ! smAPI ) {
71
71
return undefined ;
72
72
}
73
- return await smAPI . getServerSpec ( serverName ) ;
73
+ return smAPI . getServerSpec ( serverName ) ;
74
74
}
75
75
else if ( item . uri ) {
76
76
return serverSpecForUri ( item . uri ) ;
@@ -131,20 +131,13 @@ async function addTestSuites(item: OurTestItem, controller: vscode.TestControlle
131
131
} ,
132
132
) ;
133
133
if ( response ) {
134
- const run = controller . createTestRun ( new vscode . TestRunRequest ( ) , `Item '${ item . label } ' history` , false ) ;
135
134
response ?. data ?. result ?. content ?. forEach ( element => {
136
- const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ element . Name } ` ) ;
135
+ const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ element . Name } ` , item . uri ) ;
136
+ child . description = element . Status . toString ( ) ;
137
137
child . canResolveChildren = true ;
138
138
child . supportsCoverage = item . supportsCoverage ;
139
139
item . children . add ( child ) ;
140
- if ( element . Status ) {
141
- run . passed ( child , element . Duration * 1000 ) ;
142
- }
143
- else {
144
- run . failed ( child , new vscode . TestMessage ( element . ErrorDescription ) , element . Duration * 1000 ) ;
145
- }
146
140
} ) ;
147
- run . end ( ) ;
148
141
}
149
142
}
150
143
}
@@ -165,20 +158,13 @@ async function addTestCases(item: OurTestItem, controller: vscode.TestController
165
158
} ,
166
159
) ;
167
160
if ( response ) {
168
- const run = controller . createTestRun ( new vscode . TestRunRequest ( ) , `Item '${ item . label } ' history` , false ) ;
169
161
response ?. data ?. result ?. content ?. forEach ( element => {
170
- const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ element . Name . split ( '.' ) . pop ( ) } ` ) ;
162
+ const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ element . Name . split ( '.' ) . pop ( ) } ` , item . uri ) ;
163
+ child . description = element . Status . toString ( ) ;
171
164
child . canResolveChildren = true ;
172
165
child . supportsCoverage = item . supportsCoverage ;
173
166
item . children . add ( child ) ;
174
- if ( element . Status ) {
175
- run . passed ( child , element . Duration * 1000 ) ;
176
- }
177
- else {
178
- run . failed ( child , new vscode . TestMessage ( element . ErrorDescription ) , element . Duration * 1000 ) ;
179
- }
180
167
} ) ;
181
- run . end ( ) ;
182
168
}
183
169
}
184
170
}
@@ -199,25 +185,18 @@ async function addTestMethods(item: OurTestItem, controller: vscode.TestControll
199
185
} ,
200
186
) ;
201
187
if ( response ) {
202
- const run = controller . createTestRun ( new vscode . TestRunRequest ( ) , `Item '${ item . label } ' history` , false ) ;
203
188
response ?. data ?. result ?. content ?. forEach ( element => {
204
189
const methodName : string = element . Name ;
205
190
// We drop the first 4 characters of the method name because they should always be "Test"
206
- const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ methodName . slice ( 4 ) } ` ) ;
191
+ const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ methodName . slice ( 4 ) } ` , item . uri ) ;
192
+ child . description = element . Status . toString ( ) ;
207
193
child . canResolveChildren = true ;
208
194
child . supportsCoverage = item . supportsCoverage ;
209
195
item . children . add ( child ) ;
210
196
211
197
// Remember result fields so they can be reinstated when the descendant Asserts are 'run'
212
198
resultMap . set ( child , { status : element . Status , errorDescription : element . ErrorDescription , duration : element . Duration } ) ;
213
- if ( element . Status ) {
214
- run . passed ( child , element . Duration * 1000 ) ;
215
- }
216
- else {
217
- run . failed ( child , new vscode . TestMessage ( element . ErrorDescription ) , element . Duration * 1000 ) ;
218
- }
219
199
} ) ;
220
- run . end ( ) ;
221
200
}
222
201
}
223
202
}
@@ -238,35 +217,14 @@ async function addTestAsserts(item: OurTestItem, controller: vscode.TestControll
238
217
} ,
239
218
) ;
240
219
if ( response ) {
241
- const run = controller . createTestRun ( new vscode . TestRunRequest ( ) , `Item '${ item . label } ' history` , false ) ;
242
-
243
- // Prevent this level's duration from being blanked out because of children's (absent) durations
244
- const itemResult = resultMap . get ( item ) ;
245
- if ( itemResult ) {
246
- if ( itemResult . status ) {
247
- run . passed ( item , itemResult . duration * 1000 ) ;
248
- }
249
- else {
250
- run . failed ( item , new vscode . TestMessage ( itemResult . errorDescription || "(No error description)" ) , itemResult . duration * 1000 ) ;
251
- }
252
- }
253
-
254
220
response ?. data ?. result ?. content ?. forEach ( element => {
255
- const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ element . Action } ` ) ;
221
+ const child : OurTestItem = controller . createTestItem ( `${ item . id } :${ element . ID } ` , `${ element . Action } ` , item . uri ) ;
256
222
child . sortText = `${ element . Counter . toString ( ) . padStart ( element . MaxCounter . toString ( ) . length , "0" ) } ` ;
257
- child . description = element . Description ;
223
+ child . description = ` ${ element . Status } ${ element . Description } ` ;
258
224
child . canResolveChildren = false ;
259
225
child . supportsCoverage = item . supportsCoverage ;
260
226
item . children . add ( child ) ;
261
- if ( element . Status ) {
262
- run . passed ( child ) ;
263
- }
264
- else {
265
- run . failed ( child , new vscode . TestMessage ( element . Description ) ) ;
266
- }
267
227
} ) ;
268
-
269
- run . end ( ) ;
270
228
}
271
229
}
272
230
}
0 commit comments