( project: TestProject, filepath: string, )
| 489 | } |
| 490 | |
| 491 | export async function astCollectTests( |
| 492 | project: TestProject, |
| 493 | filepath: string, |
| 494 | ): Promise<File> { |
| 495 | const request = await transformSSR(project, filepath) |
| 496 | const testFilepath = relative(project.config.root, filepath) |
| 497 | if (!request) { |
| 498 | debug?.('Cannot parse', testFilepath, '(vite didn\'t return anything)') |
| 499 | return createFailedFileTask( |
| 500 | project, |
| 501 | filepath, |
| 502 | new Error(`Failed to parse ${testFilepath}. Vite didn't return anything.`), |
| 503 | ) |
| 504 | } |
| 505 | return createFileTask( |
| 506 | testFilepath, |
| 507 | request.code, |
| 508 | request.map, |
| 509 | project.serializedConfig, |
| 510 | filepath, |
| 511 | request.fileTags, |
| 512 | ) |
| 513 | } |
| 514 | |
| 515 | async function transformSSR(project: TestProject, filepath: string) { |
| 516 | // Read original file content to extract pragmas (environment, tags) |
no test coverage detected