mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(inspector): stacktrace with browser specific NPM package (#5589)
This commit is contained in:
parent
48c237b3cf
commit
fefe37e96f
@ -36,6 +36,13 @@ export function rewriteErrorMessage(e: Error, newMessage: string): Error {
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PW_LIB_DIRS = [
|
||||||
|
'playwright',
|
||||||
|
'playwright-chromium',
|
||||||
|
'playwright-firefox',
|
||||||
|
'playwright-webkit',
|
||||||
|
].map(packageName => path.join(packageName, 'lib'));
|
||||||
|
|
||||||
export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
|
export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
|
||||||
const stack = new Error().stack!;
|
const stack = new Error().stack!;
|
||||||
const frames: StackFrame[] = [];
|
const frames: StackFrame[] = [];
|
||||||
@ -46,7 +53,7 @@ export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
|
|||||||
if (frame.file.startsWith('internal'))
|
if (frame.file.startsWith('internal'))
|
||||||
continue;
|
continue;
|
||||||
const fileName = path.resolve(process.cwd(), frame.file);
|
const fileName = path.resolve(process.cwd(), frame.file);
|
||||||
if (fileName.includes(path.join('playwright', 'lib')))
|
if (PW_LIB_DIRS.some(libDir => fileName.includes(libDir)))
|
||||||
continue;
|
continue;
|
||||||
// for tests.
|
// for tests.
|
||||||
if (fileName.includes(path.join('playwright', 'src')))
|
if (fileName.includes(path.join('playwright', 'src')))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user