@@ -52,7 +52,8 @@ export type EventRecordPayload =
52
52
| TestCaseEnded
53
53
| IssueRecorded
54
54
| TestSkipped
55
- | RunEnded ;
55
+ | RunEnded
56
+ | ValueAttached ;
56
57
57
58
export interface EventRecord extends VersionedRecord {
58
59
kind : "event" ;
@@ -95,6 +96,15 @@ interface RunEnded {
95
96
messages : EventMessage [ ] ;
96
97
}
97
98
99
+ interface ValueAttached {
100
+ kind : "valueAttached" ;
101
+ _attachment : {
102
+ path ?: string ;
103
+ } ;
104
+ testID : string ;
105
+ messages : EventMessage [ ] ;
106
+ }
107
+
98
108
interface Instant {
99
109
absolute : number ;
100
110
since1970 : number ;
@@ -148,6 +158,7 @@ export enum TestSymbol {
148
158
difference = "difference" ,
149
159
warning = "warning" ,
150
160
details = "details" ,
161
+ attachment = "attachment" ,
151
162
none = "none" ,
152
163
}
153
164
@@ -169,7 +180,8 @@ export class SwiftTestingOutputParser {
169
180
170
181
constructor (
171
182
public testRunStarted : ( ) => void ,
172
- public addParameterizedTestCase : ( testClass : TestClass , parentIndex : number ) => void
183
+ public addParameterizedTestCase : ( testClass : TestClass , parentIndex : number ) => void ,
184
+ public onAttachment : ( testIndex : number , path : string ) => void
173
185
) { }
174
186
175
187
/**
@@ -457,6 +469,12 @@ export class SwiftTestingOutputParser {
457
469
this . completionMap . set ( testIndex , true ) ;
458
470
runState . completed ( testIndex , { timestamp : item . payload . instant . absolute } ) ;
459
471
return ;
472
+ } else if ( item . payload . kind === "valueAttached" && item . payload . _attachment . path ) {
473
+ const testID = this . idFromOptionalTestCase ( item . payload . testID ) ;
474
+ const testIndex = this . getTestCaseIndex ( runState , testID ) ;
475
+
476
+ this . onAttachment ( testIndex , item . payload . _attachment . path ) ;
477
+ return ;
460
478
}
461
479
}
462
480
}
@@ -521,6 +539,8 @@ export class SymbolRenderer {
521
539
return "\u{25B2}" ; // Unicode: BLACK UP-POINTING TRIANGLE
522
540
case TestSymbol . details :
523
541
return "\u{2192}" ; // Unicode: RIGHTWARDS ARROW
542
+ case TestSymbol . attachment :
543
+ return "\u{2399}" ; // Unicode: PRINT SCREEN SYMBOL
524
544
case TestSymbol . none :
525
545
return "" ;
526
546
}
@@ -540,6 +560,8 @@ export class SymbolRenderer {
540
560
return "\u{26A0}\u{FE0E}" ; // Unicode: WARNING SIGN + VARIATION SELECTOR-15 (disable emoji)
541
561
case TestSymbol . details :
542
562
return "\u{21B3}" ; // Unicode: DOWNWARDS ARROW WITH TIP RIGHTWARDS
563
+ case TestSymbol . attachment :
564
+ return "\u{2399}" ; // Unicode: PRINT SCREEN SYMBOL
543
565
case TestSymbol . none :
544
566
return " " ;
545
567
}
@@ -562,6 +584,8 @@ export class SymbolRenderer {
562
584
return `${ SymbolRenderer . ansiEscapeCodePrefix } 91m${ symbol } ${ SymbolRenderer . resetANSIEscapeCode } ` ;
563
585
case TestSymbol . warning :
564
586
return `${ SymbolRenderer . ansiEscapeCodePrefix } 93m${ symbol } ${ SymbolRenderer . resetANSIEscapeCode } ` ;
587
+ case TestSymbol . attachment :
588
+ return `${ SymbolRenderer . ansiEscapeCodePrefix } 94m${ symbol } ${ SymbolRenderer . resetANSIEscapeCode } ` ;
565
589
case TestSymbol . none :
566
590
default :
567
591
return symbol ;
0 commit comments