@@ -106,7 +106,7 @@ interface BaseEvent {
106
106
107
107
interface TestCaseEvent {
108
108
sourceLocation : SourceLocation ;
109
- _testCase : TestCase ;
109
+ _testCase ? : TestCase ;
110
110
}
111
111
112
112
interface TestStarted extends BaseEvent {
@@ -225,6 +225,12 @@ export class SwiftTestingOutputParser {
225
225
return testCase . id === "argumentIDs: nil" ? testCase . displayName : testCase . id ;
226
226
}
227
227
228
+ private idFromOptionalTestCase ( testID : string , testCase ?: TestCase ) : string {
229
+ return testCase
230
+ ? this . testCaseId ( testID , this . idFromTestCase ( testCase ) )
231
+ : this . testName ( testID ) ;
232
+ }
233
+
228
234
private parameterizedFunctionTestCaseToTestClass (
229
235
testId : string ,
230
236
testCase : TestCase ,
@@ -300,9 +306,9 @@ export class SwiftTestingOutputParser {
300
306
const testIndex = runState . getTestItemIndex ( testName , undefined ) ;
301
307
runState . started ( testIndex , item . payload . instant . absolute ) ;
302
308
} else if ( item . payload . kind === "testCaseStarted" ) {
303
- const testID = this . testCaseId (
309
+ const testID = this . idFromOptionalTestCase (
304
310
item . payload . testID ,
305
- this . idFromTestCase ( item . payload . _testCase )
311
+ item . payload . _testCase
306
312
) ;
307
313
const testIndex = this . getTestCaseIndex ( runState , testID ) ;
308
314
runState . started ( testIndex , item . payload . instant . absolute ) ;
@@ -311,11 +317,12 @@ export class SwiftTestingOutputParser {
311
317
const testIndex = runState . getTestItemIndex ( testName , undefined ) ;
312
318
runState . skipped ( testIndex ) ;
313
319
} else if ( item . payload . kind === "issueRecorded" ) {
314
- const testID = this . testCaseId (
320
+ const testID = this . idFromOptionalTestCase (
315
321
item . payload . testID ,
316
- this . idFromTestCase ( item . payload . _testCase )
322
+ item . payload . _testCase
317
323
) ;
318
324
const testIndex = this . getTestCaseIndex ( runState , testID ) ;
325
+
319
326
const isKnown = item . payload . issue . isKnown ;
320
327
const sourceLocation = item . payload . issue . sourceLocation ;
321
328
const location = sourceLocationToVSCodeLocation (
@@ -345,9 +352,9 @@ export class SwiftTestingOutputParser {
345
352
this . completionMap . set ( testIndex , true ) ;
346
353
runState . completed ( testIndex , { timestamp : item . payload . instant . absolute } ) ;
347
354
} else if ( item . payload . kind === "testCaseEnded" ) {
348
- const testID = this . testCaseId (
355
+ const testID = this . idFromOptionalTestCase (
349
356
item . payload . testID ,
350
- this . idFromTestCase ( item . payload . _testCase )
357
+ item . payload . _testCase
351
358
) ;
352
359
const testIndex = this . getTestCaseIndex ( runState , testID ) ;
353
360
0 commit comments