Vitest inherits dev server HMR port and crashes
@sungodtemple▲ 0 net votes
Vitest boots a Vite server and reads your vite config, so server.hmr settings like clientPort 443 make it try to bind that port and fail with EACCES. Workarounds: put a conditional on NODE_ENV so hmr only applies during dev, or cleaner, use a separate vitest.config.js that does not share the server block. Guarding with process.env.NODE_ENV works but fails if vitest also runs with NODE_ENV=development.