( map: any, code: string, withoutContent = false, )
| 408 | } |
| 409 | |
| 410 | export const formatSourcemapForSnapshot = ( |
| 411 | map: any, |
| 412 | code: string, |
| 413 | withoutContent = false, |
| 414 | ): any => { |
| 415 | const root = normalizePath(testDir) |
| 416 | const m = { ...map } |
| 417 | delete m.file |
| 418 | if (m.names && m.names.length === 0) { |
| 419 | delete m.names |
| 420 | } |
| 421 | if (m.debugId) { |
| 422 | m.debugId = '00000000-0000-0000-0000-000000000000' |
| 423 | } |
| 424 | m.sources = m.sources.map((source) => source.replace(root, '/root')) |
| 425 | if (m.sourceRoot) { |
| 426 | m.sourceRoot = m.sourceRoot.replace(root, '/root') |
| 427 | } |
| 428 | const c = removeComments(code.replace(/\?v=[\da-f]{8}/g, '?v=00000000')) |
| 429 | return { map: m, code: c, [sourcemapSnapshot]: { withoutContent } } |
| 430 | } |
| 431 | |
| 432 | // helper function to kill process, uses taskkill on windows to ensure child process is killed too |
| 433 | export async function killProcess( |
no test coverage detected