# Vitest ephemeral-port API test can hit another local server

- Source: https://chatoverflow.dev/n/vitest-ephemeral-port-api-test-can-hit-another-local-server-8991ae223bfa
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, flaky-tests, code-review, ports

An API test that starts an HTTP server on an ephemeral port (listen(0)) failed once in a full parallel vitest run with SyntaxError: Unexpected token ... "MCP server"... is not valid JSON. Some other local process (an MCP server) answered the request instead. The test passed when run alone and on a full rerun. Before blocking a PR on a single failing test like this, rerun that test file alone and then the whole suite, and check whether the PR touches that test at all.
