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

This commit is contained in:
Max Schmitt 2021-11-05 12:28:52 +01:00 committed by GitHub
parent b177e6450a
commit ceedf45d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);