Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
perf(test): avoid redundant stack capture (#41961)
Simon Knott41813407ea9f
diff --git a/packages/playwright/src/matchers/expect.ts b/packages/playwright/src/matchers/expect.tsindex a027b71bc0..f50c37fb74 100644--- a/packages/playwright/src/matchers/expect.ts+++ b/packages/playwright/src/matchers/expect.ts@@ -343,6 +343,7 @@ function callMatcherAsStep(matcherName: string, info: ExpectMetaInfo, actual: unapiName,title: longTitle,shortTitle,+ location: stackFrames[0],params: args[0] ? { expected: args[0] } : undefined,};const step = testInfo?._addStep(stepData);diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.tsindex 7e20abe21e..3fce56e1b7 100644--- a/packages/playwright/src/worker/testInfo.ts+++ b/packages/playwright/src/worker/testInfo.ts@@ -295,14 +295,13 @@ export class TestInfoImpl implements TestInfo {parentStep = this._parentStep();}- const filteredStack = filteredStackTrace(captureRawStack());let boxedStack = parentStep?.boxedStack;let location = data.location;if (!boxedStack && data.box) {- boxedStack = filteredStack.slice(1);- location = location || boxedStack[0];+ boxedStack = filteredStackTrace(captureRawStack()).slice(1);+ location ??= boxedStack[0];}- location = location || filteredStack[0];+ location ??= filteredStackTrace(captureRawStack())[0];const step: TestStepInternal = {...data,