Skip to content

Commit

Permalink
patch(playwright): crxZone that provides api name
Browse files Browse the repository at this point in the history
Required for tracing
  • Loading branch information
ruifigueira committed Dec 11, 2024
1 parent 4998414 commit f3d6582
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
if (apiZone)
return await func(apiZone);

const crxZone = zones.zoneData<{ apiName: string }>('crxZone');

const stackTrace = captureLibraryStackTrace();
let apiName: string | undefined = stackTrace.apiName;
let apiName: string | undefined = crxZone?.apiName ?? stackTrace.apiName;
const frames: channels.StackFrame[] = stackTrace.frames;

if (isInternal === undefined)
Expand Down
2 changes: 1 addition & 1 deletion playwright/packages/playwright-core/src/utils/zones.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { AsyncLocalStorage } from 'async_hooks';

export type ZoneType = 'apiZone' | 'expectZone' | 'stepZone';
export type ZoneType = 'crxZone' | 'apiZone' | 'expectZone' | 'stepZone';

class ZoneManager {
private readonly _asyncLocalStorage = new AsyncLocalStorage<Zone|undefined>();
Expand Down

0 comments on commit f3d6582

Please sign in to comment.