tests(e2e): fix e2e failures on Linux and Windows (#3642)

This commit is contained in:
Lucas Fernandes Nogueira
2026-09-25 13:43:07 -03:00
committed by GitHub
parent b870626a5e
commit 3a01943572
4 changed files with 23 additions and 10 deletions
+8 -5
View File
@@ -49,7 +49,9 @@ export interface FixtureServer {
* - `ws /ws` — a WebSocket echo endpoint: text and binary messages are sent
* back as-is, and {@link WEBSOCKET_CLOSE_REQUEST} makes the server close the
* connection with {@link WEBSOCKET_CLOSE_CODE}. On `/ws/headers` the server
* first sends the upgrade request's headers as a JSON text message.
* answers the first message with the upgrade request's headers as a JSON
* text message instead (not sent on connect, where it could arrive before
* the client attached a listener).
*/
export function startFixtureServer(): Promise<FixtureServer> {
const server = http.createServer((req, res) => {
@@ -111,11 +113,12 @@ export function startFixtureServer(): Promise<FixtureServer> {
return
}
wss.handleUpgrade(req, socket, head, (ws) => {
if (pathname === '/ws/headers') {
ws.send(JSON.stringify(req.headers))
}
let sendHeaders = pathname === '/ws/headers'
ws.on('message', (data, isBinary) => {
if (
if (sendHeaders) {
sendHeaders = false
ws.send(JSON.stringify(req.headers))
} else if (
!isBinary
&& Buffer.isBuffer(data)
&& data.toString('utf8') === WEBSOCKET_CLOSE_REQUEST