Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix: support .mjs files with Playwright Inspector (#10043)

Max Schmittceedf45d4a79
diff --git a/packages/playwright-core/src/utils/stackTrace.ts b/packages/playwright-core/src/utils/stackTrace.ts
index 346b5cf08d..433a230de6 100644
--- a/packages/playwright-core/src/utils/stackTrace.ts
+++ b/packages/playwright-core/src/utils/stackTrace.ts
@@ -72,7 +72,12 @@ export function captureStackTrace(): ParsedStackTrace {
return null;
if (frame.file.startsWith(WS_LIB))
return null;
- const fileName = path.resolve(process.cwd(), frame.file);
+ // Workaround for https://github.com/tapjs/stack-utils/issues/60
+ let fileName: string;
+ if (frame.file.startsWith('file://'))
+ fileName = new URL(frame.file).pathname;
+ else
+ fileName = path.resolve(process.cwd(), frame.file);
if (isTesting && fileName.includes(path.join('playwright', 'tests', 'config', 'coverage.js')))
return null;
const inClient = fileName.startsWith(CLIENT_LIB) || fileName.startsWith(CLIENT_SRC);