Component evidence

captureRawStack (playwright/stackTrace.ts)

playwright-bdd · src/playwright/stackTrace.ts · typescript · MIT
scraping

Utility to capture, parse, and rewrite stack traces for debugging.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/vitalets/playwright-bdd | License: MIT | Copyright 2023 Vitaliy Potapov
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Based on Playwright's stackTrace.ts
 * See: https://github.com/microsoft/playwright/blob/release-1.51/packages/playwright-core/src/utils/isomorphic/stackTrace.ts
 */

/* eslint-disable max-lines-per-function, max-statements, visual/complexity, max-depth */

export type RawStack = string[];

export type StackFrame = {
  file: string;
  line: number;
  column: number;
  function?: string;
};

export function captureRawStack(): RawStack {
  const stackTraceLimit = Error.stackTraceLimit;
  Error.stackTraceLimit = 50;
  const error = new Error();
  const stack = error.stack || '';
  Error.stackTraceLimit = stackTraceLimit;


... (truncated -- full source via MCP)