* 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 */
// 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)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key