// Ignore the source files traces for local testing. const SOURCE_FRAME = /[/\\]msw[/\\]src[/\\](.+)/ const BUILD_FRAME = /(node_modules)?[/\\]lib[/\\](core|browser|node|native|iife)[/\\]|^[^/\\]*$/ /** * Return the stack trace frame of a function's invocation. */ export function getCallFrame(error: Error) { // In { return !(SOURCE_FRAME.test(frame) || BUILD_FRAME.test(frame)) }) if (!declarationFrame) { return } // Extract file reference from the stack frame. const declarationPath = declarationFrame .replace(/\s*at [^()]*\(([^)]+)\)/, '$1') .replace(/^@/, '') return declarationPath }