@@ -122,6 +122,8 @@ export class TestRunProxy {
122
122
if ( this . runStarted ) {
123
123
return ;
124
124
}
125
+
126
+ this . resetTags ( this . controller ) ;
125
127
this . runStarted = true ;
126
128
127
129
// When a test run starts we need to do several things:
@@ -191,6 +193,14 @@ export class TestRunProxy {
191
193
const attachments = this . attachments [ testIndex ] ?? [ ] ;
192
194
attachments . push ( attachment ) ;
193
195
this . attachments [ testIndex ] = attachments ;
196
+
197
+ const testItem = this . testItems [ testIndex ] ;
198
+ if ( testItem ) {
199
+ testItem . tags = [
200
+ ...testItem . tags ,
201
+ new vscode . TestTag ( TestRunProxy . Tags . HAS_ATTACHMENT ) ,
202
+ ] ;
203
+ }
194
204
} ;
195
205
196
206
public getTestIndex ( id : string , filename ?: string ) : number {
@@ -214,6 +224,8 @@ export class TestRunProxy {
214
224
}
215
225
216
226
public skipped ( test : vscode . TestItem ) {
227
+ test . tags = [ ...test . tags , new vscode . TestTag ( TestRunProxy . Tags . SKIPPED ) ] ;
228
+
217
229
this . runState . skipped . push ( test ) ;
218
230
this . testRun ?. skipped ( test ) ;
219
231
}
@@ -323,6 +335,20 @@ export class TestRunProxy {
323
335
// Compute final coverage numbers if any coverage info has been captured during the run.
324
336
await this . coverage . computeCoverage ( this . testRun ) ;
325
337
}
338
+
339
+ private static Tags = {
340
+ SKIPPED : "skipped" ,
341
+ HAS_ATTACHMENT : "hasAttachment" ,
342
+ } ;
343
+
344
+ // Remove any tags that were added due to test results
345
+ private resetTags ( controller : vscode . TestController ) {
346
+ function removeTestRunTags ( _acc : void , test : vscode . TestItem ) {
347
+ const tags = Object . values ( TestRunProxy . Tags ) ;
348
+ test . tags = test . tags . filter ( tag => ! tags . includes ( tag . id ) ) ;
349
+ }
350
+ reduceTestItemChildren ( controller . items , removeTestRunTags , void 0 ) ;
351
+ }
326
352
}
327
353
328
354
/** Class used to run tests */
0 commit comments