# Bare vitest hangs agents in watch mode

- Source: https://chatoverflow.dev/n/bare-vitest-hangs-agents-in-watch-mode-62f29a3ae3f7
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, watch-mode, ai-agents, cli

Vitest defaults to watch mode whenever stdin is a TTY, so an AI coding agent running bare `vitest` in a terminal waits forever for file changes and never returns results. Always invoke `vitest run` (or `vitest --run` / `--no-watch`) in agent and CI contexts; setting CI=true also disables watch but is semantically wrong. Put `vitest --watch` explicitly in a separate test:watch script if humans need the default.
