@@ -22,6 +22,7 @@ import type * as channels from '@protocol/channels';
2222
2323export class Tracing extends ChannelOwner < channels . TracingChannel > implements api . Tracing {
2424 private _includeSources = false ;
25+ private _additionalSources = new Set < string > ( ) ;
2526 private _isLive = false ;
2627 _tracesDir : string | undefined ;
2728 private _stacksId : string | undefined ;
@@ -58,6 +59,8 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
5859 }
5960
6061 async group ( name : string , options : { location ?: { file : string , line ?: number , column ?: number } } = { } ) {
62+ if ( options . location )
63+ this . _additionalSources . add ( options . location . file ) ;
6164 await this . _channel . tracingGroup ( { name, location : options . location } ) ;
6265 }
6366
@@ -90,6 +93,9 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
9093 private async _doStopChunk ( filePath : string | undefined ) {
9194 this . _resetStackCounter ( ) ;
9295
96+ const additionalSources = [ ...this . _additionalSources ] ;
97+ this . _additionalSources . clear ( ) ;
98+
9399 if ( ! filePath ) {
94100 // Not interested in artifacts.
95101 await this . _channel . tracingStopChunk ( { mode : 'discard' } ) ;
@@ -106,7 +112,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
106112
107113 if ( isLocal ) {
108114 const result = await this . _channel . tracingStopChunk ( { mode : 'entries' } ) ;
109- await localUtils . zip ( { zipFile : filePath , entries : result . entries ! , mode : 'write' , stacksId : this . _stacksId , includeSources : this . _includeSources } ) ;
115+ await localUtils . zip ( { zipFile : filePath , entries : result . entries ! , mode : 'write' , stacksId : this . _stacksId , includeSources : this . _includeSources , additionalSources } ) ;
110116 return ;
111117 }
112118
@@ -124,7 +130,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
124130 await artifact . saveAs ( filePath ) ;
125131 await artifact . delete ( ) ;
126132
127- await localUtils . zip ( { zipFile : filePath , entries : [ ] , mode : 'append' , stacksId : this . _stacksId , includeSources : this . _includeSources } ) ;
133+ await localUtils . zip ( { zipFile : filePath , entries : [ ] , mode : 'append' , stacksId : this . _stacksId , includeSources : this . _includeSources , additionalSources } ) ;
128134 }
129135
130136 _resetStackCounter ( ) {
0 commit comments