(app: NextServer)
| 673 | } |
| 674 | |
| 675 | export async function startApp(app: NextServer) { |
| 676 | // force require usage instead of dynamic import in jest |
| 677 | // x-ref: https://github.com/nodejs/node/issues/35889 |
| 678 | process.env.__NEXT_TEST_MODE = 'jest' |
| 679 | |
| 680 | // TODO: tests that use this should be migrated to use |
| 681 | // the nextStart test function instead as it tests outside |
| 682 | // of jest's context |
| 683 | await app.prepare() |
| 684 | const handler = app.getRequestHandler() |
| 685 | const server = http.createServer(handler) |
| 686 | server['__app'] = app |
| 687 | |
| 688 | await startListen(server) |
| 689 | |
| 690 | return server |
| 691 | } |
| 692 | |
| 693 | export async function stopApp(server: http.Server | undefined) { |
| 694 | if (!server) { |
no test coverage detected