chore: run the basics server tests against Server.respond - #16872
chore: run the basics server tests against Server.respond#16872Nic-Polumeyv wants to merge 5 commits into
Server.respond#16872Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/2c0208d60571bac7ae29dace6cbaa0456779077bOpen in |
|
|
Noodling on some tweaks in #16879. One thing neither PR covers AFAICT: the existing setup tests the dev server as well as the prod build, but this only tests the latter IIUC? |
|
Dev is back on 535985a, a second vitest project runs the same spec through Vite in middleware mode. 79 build / 67 dev, 12 skipped where Playwright skipped them too. |
The server tests in
basicsnever needed a browser: they assert on status, headers and body. Running them through Playwright with JavaScript off meant a preview server and a browser per project, repeated in every no-js leg of the matrix, and a 1 to 2 minute loop to run one of them locally. The file said so itself (server.test.js:33, "this would ideally be a unit test ofServer").80 of the 93 now run under vitest against the built app served in-process with
getRequest/setResponsefrom@sveltejs/kit/node, the adapter-node path. The whole file runs in ~2 s after a build, withpnpm test:unit, no browser or port involved, and failures come back as a plain response diff instead of a Playwright trace. Each test also stops being repeated across the six no-js legs and theasync/resolutionvariants.13 stay in Playwright: 3 assert dev-server behaviour, 10 need the static-asset and prerendered-page serving that adapters and
vite previewdo aroundServer. Anything that only talks toServercan follow the same path with no new plumbing.