(framework: string)
| 56 | ); |
| 57 | |
| 58 | async function measure(framework: string) { |
| 59 | const { process: runningProcess, port } = await preview(framework); |
| 60 | // Hydrogen has a very long boot up period as it is launchhing miniflare |
| 61 | await sleep(framework === 'hydrogen' ? 15000 : 5000); |
| 62 | |
| 63 | const usePath = ssrPathMap[framework]?.[path] || path; |
| 64 | const measureUrl = `http://localhost:${port}${usePath}`; |
| 65 | |
| 66 | const result = (resultsMap[framework] = await measureTimeForRequests( |
| 67 | measureUrl |
| 68 | )); |
| 69 | |
| 70 | console.info(chalk.green(`Done with ${framework}:`), result); |
| 71 | |
| 72 | // Don't throw an error when we kill the process below |
| 73 | runningProcess.catch(() => null); |
| 74 | await runningProcess.kill(); |
| 75 | } |
| 76 | |
| 77 | async function measureTimeForRequests(url: string) { |
| 78 | const result = await autocannon({ |
no test coverage detected