(opts?: {
contentAssetMiddleware?: MountMcpAndApiOptions['contentAssetMiddleware'];
})
| 464 | } |
| 465 | |
| 466 | async function startWithShell(opts?: { |
| 467 | contentAssetMiddleware?: MountMcpAndApiOptions['contentAssetMiddleware']; |
| 468 | }): Promise<{ port: number; shellDir: string }> { |
| 469 | const shellDir = makeShellDir(); |
| 470 | const httpServer = createServer(); |
| 471 | const mount = mountMcpAndApi({ |
| 472 | httpServer, |
| 473 | hocuspocus, |
| 474 | log, |
| 475 | contentAssetMiddleware: opts?.contentAssetMiddleware, |
| 476 | reactShellMiddleware: sirv(shellDir, { |
| 477 | single: true, |
| 478 | gzip: true, |
| 479 | immutable: true, |
| 480 | }), |
| 481 | }); |
| 482 | const port = await getFreeLoopbackPort(); |
| 483 | await new Promise<void>((resolve) => httpServer.listen(port, '127.0.0.1', () => resolve())); |
| 484 | servers.push({ httpServer, mount }); |
| 485 | return { port, shellDir }; |
| 486 | } |
| 487 | |
| 488 | test('serves index.html on root request (SPA shell entry)', async () => { |
| 489 | const { port } = await startWithShell(); |
no test coverage detected