From 0db9d70bb1416c10ab0452d07695e9df5077acc5 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Mon, 12 Oct 2026 13:22:00 +0800 Subject: [PATCH] test: let the OS choose the vitest browser fixture's server port Vitest browser mode listens on the fixed port 63315 by default. On Windows runners that port can fall inside an excluded port range, where listening fails with EACCES and Vitest does not fall back to another port. Co-Authored-By: Claude Opus 5.5 --- .../vitest_browser_cache/vitest.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/vt_bin/tests/e2e_snapshots/fixtures/vitest_browser_cache/vitest.config.js b/crates/vt_bin/tests/e2e_snapshots/fixtures/vitest_browser_cache/vitest.config.js index 1604a770d..41da653f3 100644 --- a/crates/vt_bin/tests/e2e_snapshots/fixtures/vitest_browser_cache/vitest.config.js +++ b/crates/vt_bin/tests/e2e_snapshots/fixtures/vitest_browser_cache/vitest.config.js @@ -7,6 +7,24 @@ class NoTestSummaryReporter extends DefaultReporter { } export default defineConfig({ + plugins: [ + { + name: 'browser-server-port', + // Vitest's fixed default browser server port (63315) can fall inside a + // Windows excluded port range, where listening fails with EACCES and + // Vite does not fall back to another port. Port 0 lets the OS choose. + // Vitest replaces `test.api.port: 0` with the default and prints an + // "API started at" line when `test.api` is set, so override the port + // after Vitest resolves `test.api`. + enforce: 'post', + config: { + order: 'post', + handler(config) { + config.test.api.port = 0; + }, + }, + }, + ], test: { reporters: [new NoTestSummaryReporter({ summary: false }), 'json'], outputFile: { json: 'dist/result.json' },