mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
chore: print full stacks when PWDEBUGIMPL is set (#16113)
For debugging purposes, especially on the client's computers.
This commit is contained in:
parent
97bb0f3d46
commit
5481e25015
@ -83,9 +83,9 @@ export function captureStackTrace(rawStack?: string): ParsedStackTrace {
|
|||||||
const { frame, fileName } = parseStackTraceLine(line);
|
const { frame, fileName } = parseStackTraceLine(line);
|
||||||
if (!frame || !frame.file || !fileName)
|
if (!frame || !frame.file || !fileName)
|
||||||
return null;
|
return null;
|
||||||
if (isInternalFileName(frame.file, frame.function))
|
if (!process.env.PWDEBUGIMPL && isInternalFileName(frame.file, frame.function))
|
||||||
return null;
|
return null;
|
||||||
if (isTesting && fileName.includes(COVERAGE_PATH))
|
if (!process.env.PWDEBUGIMPL && isTesting && fileName.includes(COVERAGE_PATH))
|
||||||
return null;
|
return null;
|
||||||
const inCore = fileName.startsWith(CORE_LIB) || fileName.startsWith(CORE_SRC);
|
const inCore = fileName.startsWith(CORE_LIB) || fileName.startsWith(CORE_SRC);
|
||||||
const parsed: ParsedFrame = {
|
const parsed: ParsedFrame = {
|
||||||
@ -109,7 +109,8 @@ export function captureStackTrace(rawStack?: string): ParsedStackTrace {
|
|||||||
if (parsedFrames[i].inCore && !parsedFrames[i + 1].inCore) {
|
if (parsedFrames[i].inCore && !parsedFrames[i + 1].inCore) {
|
||||||
const frame = parsedFrames[i].frame;
|
const frame = parsedFrames[i].frame;
|
||||||
apiName = normalizeAPIName(frame.function);
|
apiName = normalizeAPIName(frame.function);
|
||||||
parsedFrames = parsedFrames.slice(i + 1);
|
if (!process.env.PWDEBUGIMPL)
|
||||||
|
parsedFrames = parsedFrames.slice(i + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,6 +126,8 @@ export function captureStackTrace(rawStack?: string): ParsedStackTrace {
|
|||||||
|
|
||||||
// Hide all test runner and library frames in the user stack (event handlers produce them).
|
// Hide all test runner and library frames in the user stack (event handlers produce them).
|
||||||
parsedFrames = parsedFrames.filter((f, i) => {
|
parsedFrames = parsedFrames.filter((f, i) => {
|
||||||
|
if (process.env.PWDEBUGIMPL)
|
||||||
|
return true;
|
||||||
if (f.frame.file.startsWith(TEST_DIR_SRC) || f.frame.file.startsWith(TEST_DIR_LIB))
|
if (f.frame.file.startsWith(TEST_DIR_SRC) || f.frame.file.startsWith(TEST_DIR_LIB))
|
||||||
return false;
|
return false;
|
||||||
if (i && f.frame.file.startsWith(CORE_DIR))
|
if (i && f.frame.file.startsWith(CORE_DIR))
|
||||||
|
@ -35,6 +35,9 @@ const EXPECT_PATH_IMPL = require.resolve('./expectBundleImpl');
|
|||||||
const PLAYWRIGHT_TEST_PATH = path.join(__dirname, '..');
|
const PLAYWRIGHT_TEST_PATH = path.join(__dirname, '..');
|
||||||
|
|
||||||
function filterStackTrace(e: Error) {
|
function filterStackTrace(e: Error) {
|
||||||
|
if (process.env.PWDEBUGIMPL)
|
||||||
|
return;
|
||||||
|
|
||||||
// This method filters internal stack frames using Error.prepareStackTrace
|
// This method filters internal stack frames using Error.prepareStackTrace
|
||||||
// hook. Read more about the hook: https://v8.dev/docs/stack-trace-api
|
// hook. Read more about the hook: https://v8.dev/docs/stack-trace-api
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user