(ctx: Vitest)
| 425 | }) |
| 426 | |
| 427 | async function getSerializedModuleGraph(ctx: Vitest) { |
| 428 | const files = ctx.state.getFiles().slice().sort((a, b) => a.filepath.localeCompare(b.filepath)) |
| 429 | const moduleGraphs = Object.fromEntries( |
| 430 | await Promise.all( |
| 431 | files.map(async (file) => { |
| 432 | const projectName = file.projectName || '' |
| 433 | const project = ctx.getProjectByName(projectName) |
| 434 | const graph = await getModuleGraph( |
| 435 | ctx, |
| 436 | projectName, |
| 437 | file.filepath, |
| 438 | project.config.browser.enabled, |
| 439 | ) |
| 440 | return [file.filepath, graph] as const |
| 441 | }), |
| 442 | ), |
| 443 | ) |
| 444 | return JSON.stringify(moduleGraphs, null, 2) |
| 445 | .replaceAll(ctx.config.root, '<root>') |
| 446 | .replace(/"[^"\n]*\/node_modules\//g, '"<node_modules>/') |
| 447 | .replace(/<node_modules>\/\.vite\/vitest\/[a-f0-9]{40}\/deps\/([^"?]+)/g, '<optimized-deps>/$1') |
| 448 | .replace(/\?v=[a-f0-9]+/g, '?v=<hash>') |
| 449 | } |
| 450 | |
| 451 | function trimReporterOutput(report: string) { |
| 452 | const rows = report |
no test coverage detected