next.js
c018ffeb - Add e2e coverage for next start's HTTP and process behavior (#101710)

Commit
2 days ago
Add e2e coverage for next start's HTTP and process behavior (#101710) ## Summary Adds end-to-end coverage for what `next start` does over HTTP and as a process today, ahead of the experimental front server in #101695, which builds on this PR. Every test asserts current behavior and passes against plain `next start`, so the front (or any later change to how `next start` serves requests) can be checked against the same suites. - `test/production/app-dir/front-server/front-server.test.ts`: forwarded headers sent and not sent, `request.url` built from the public port, request targets (`%2F`, `%C3%A9`, `/a/../b`, `//x`, a malformed escape), chunked and 8 MB bodies, repeated `set-cookie`, custom and Node-worded status lines, a route handler and a Suspense page streaming before they end, a WebSocket through a rewrite to an external server, a server-action redirect, keep-alive closing after about 5 s, and a POST sent around when an idle connection would expire. - `test/production/app-dir/front-server/front-server-process.test.ts`: starts `next start` itself and checks that it owns the public port, exits 143 on SIGTERM and 130 on Ctrl+C, finishes an in-flight request across SIGTERM, honors `-p` and `--keepAliveTimeout`, and reports "Failed to start server" once when the port is taken. On Linux it reads listening sockets from `/proc`, since the CI runners have no `lsof`. - `raw-http.ts` sends requests byte for byte, so targets and headers reach the server as a client wrote them. These run in every production CI job: about 61 s of test time locally (42 s and 18.5 s). The slowest tests sleep on purpose: the idle-connection POST (about 19 s) and the keep-alive close (about 6 s). The keep-alive and `--keepAliveTimeout` checks use wide windows (4–7.5 s and 1.5–4 s), since Node 24 keeps sockets about a second past the timeout. The in-flight-across-SIGTERM test waits a fixed 500 ms before signalling, so a very slow runner could flake it. ## Verification - Both suites pass against plain `next start` (Turbopack, Node 24.22.2): 22/22 and 7/7. An earlier version of them ran in CI on Linux with Node 20.9 as part of #101695. <!-- NEXT_JS_LLM --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Author
Parents
Loading