Skip to content

Commit 9e69146

Browse files
cherry-pick(release-1.9): stacktrace with browser specific NPM package (#5589) (#5598)
This cherry-picks fefe37e Co-authored-by: Max Schmitt <[email protected]>
1 parent 37bd44f commit 9e69146

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils/stackTrace.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export function rewriteErrorMessage(e: Error, newMessage: string): Error {
3636
return e;
3737
}
3838

39+
const PW_LIB_DIRS = [
40+
'playwright',
41+
'playwright-chromium',
42+
'playwright-firefox',
43+
'playwright-webkit',
44+
].map(packageName => path.join(packageName, 'lib'));
45+
3946
export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
4047
const stack = new Error().stack!;
4148
const frames: StackFrame[] = [];
@@ -46,7 +53,7 @@ export function captureStackTrace(): { stack: string, frames: StackFrame[] } {
4653
if (frame.file.startsWith('internal'))
4754
continue;
4855
const fileName = path.resolve(process.cwd(), frame.file);
49-
if (fileName.includes(path.join('playwright', 'lib')))
56+
if (PW_LIB_DIRS.some(libDir => fileName.includes(libDir)))
5057
continue;
5158
// for tests.
5259
if (fileName.includes(path.join('playwright', 'src')))

0 commit comments

Comments
 (0)