@@ -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 _isLive = false ;
2526 _tracesDir : string | undefined ;
2627 private _stacksId : string | undefined ;
2728 private _isTracing = false ;
@@ -37,21 +38,22 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
3738 async start ( options : { name ?: string , title ?: string , snapshots ?: boolean , screenshots ?: boolean , sources ?: boolean , _live ?: boolean } = { } ) {
3839 await this . _wrapApiCall ( async ( ) => {
3940 this . _includeSources = ! ! options . sources ;
41+ this . _isLive = ! ! options . _live ;
4042 await this . _channel . tracingStart ( {
4143 name : options . name ,
4244 snapshots : options . snapshots ,
4345 screenshots : options . screenshots ,
4446 live : options . _live ,
4547 } ) ;
4648 const { traceName } = await this . _channel . tracingStartChunk ( { name : options . name , title : options . title } ) ;
47- await this . _startCollectingStacks ( traceName ) ;
49+ await this . _startCollectingStacks ( traceName , this . _isLive ) ;
4850 } ) ;
4951 }
5052
5153 async startChunk ( options : { name ?: string , title ?: string } = { } ) {
5254 await this . _wrapApiCall ( async ( ) => {
5355 const { traceName } = await this . _channel . tracingStartChunk ( options ) ;
54- await this . _startCollectingStacks ( traceName ) ;
56+ await this . _startCollectingStacks ( traceName , this . _isLive ) ;
5557 } ) ;
5658 }
5759
@@ -63,12 +65,12 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
6365 await this . _channel . tracingGroupEnd ( ) ;
6466 }
6567
66- private async _startCollectingStacks ( traceName : string ) {
68+ private async _startCollectingStacks ( traceName : string , live : boolean ) {
6769 if ( ! this . _isTracing ) {
6870 this . _isTracing = true ;
6971 this . _connection . setIsTracing ( true ) ;
7072 }
71- const result = await this . _connection . localUtils ( ) ?. tracingStarted ( { tracesDir : this . _tracesDir , traceName } ) ;
73+ const result = await this . _connection . localUtils ( ) ?. tracingStarted ( { tracesDir : this . _tracesDir , traceName, live } ) ;
7274 this . _stacksId = result ?. stacksId ;
7375 }
7476
0 commit comments