in src/reporters/reporter-util.ts [40:80]
function prepareStackFrame(line: string): StackFrame {
const frame = stackUtils.parseLine(line);
if (!frame) {
return;
}
// ignore node internals
if (frame.file?.startsWith('internal') || frame.file?.startsWith('node:')) {
return;
}
// handle relative URLs
let file = frame.file?.startsWith('file://')
? fileURLToPath(frame.file)
: resolve(process.cwd(), frame.file);
// ignore node_modules
if (file.includes(`${sep}node_modules${sep}`)) {
return;
}
// filter library and PW files
if (!filterLibInternals(file)) {
return;
}
// When we bundle the journeys, we store the absolute path of the journey
// files and write the sourcemap relative to these files. When we try to
// extract the sourcemap file location, the stacktrace will be relatively
// resolved to these files which would be under `journeys` folder. So we strip
// these extra `journeys` from the path to get the correct file location.
if (frame.file?.includes('journeys/journeys')) {
file = file.replace('journeys/journeys', 'journeys');
}
return {
file,
line: frame.line || 0,
column: frame.column || 0,
function: frame.function,
};
}