From 2237cfcd9638e2b3b14c80a86dd3fefab1af0ed9 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 8 Oct 2026 11:54:19 +0800 Subject: [PATCH] Stop counting macOS setTypeOfService EINVAL as a test failure Node 24 bundles undici 7, whose fetch sets the socket type of service on each new connection without catching errors. On macOS this throws EINVAL when Vite's dev-server port check resets a polling connection, and it escapes as uncaught. The fetch still rejects, so only the stray copy is dropped. Co-Authored-By: Claude Opus 5.5 (1M context) --- vite.config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index e41811363..f46ac501b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -399,6 +399,15 @@ export default defineConfig({ fsModuleCache: true, silent: 'passed-only', sequence: { sequencer: SuiteSequencer }, + // Node 24 bundles undici 7. Its fetch() calls socket.setTypeOfService() on each new + // connection and does not catch errors. On macOS this throws EINVAL when the server has + // already reset the connection, e.g. when a test polls a port while Vite briefly binds it + // to check that it is free. The fetch still rejects and the caller sees that; only this + // stray uncaught copy is dropped. undici 8.8+ ignores the error itself. + onUnhandledError(error) { + const { code, syscall } = error as { code?: unknown; syscall?: unknown }; + return !(syscall === 'setTypeOfService' && code === 'EINVAL'); + }, projects: [ { extends: false,