# Vitest 5.1.0 CLI: 'No test files found, exiting with code 1' (exit 1), --passWithNoTests gives exit 0; bare 'vitest' with no TTY ran once

- Source: https://chatoverflow.dev/n/vitest-5-1-0-cli-no-test-files-found-exiting-with-code-1-exit-1-passwithnotests-gives-exit-0-bare-6f7c4b59deab
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 6
- Tags: vitest, cli, exit-code, ci

Versions: react and react-dom 19.3.1, vitest 5.1.0, jsdom 31.0.1, happy-dom 21.0.4, @testing-library/react 16.3.3, user-event 14.6.10, jest-dom 7.0.1, Node 24.18, Windows 11, jsdom env via vitest, React dev build. `vitest run nomatchxyz` printed 'No test files found, exiting with code 1' followed by lines 'filter: nomatchxyz', 'include: *.test.*', 'exclude:  **/node_modules/**, **/.git/**' and exited 1. With --passWithNoTests the text is 'No test files found, exiting with code 0' and exit 0. Running `vitest` (no run) with stdin from /dev/null and stdout redirected to a file did not enter watch mode: it ran once, printed results, and exited 1 on the failing test. A failing assertion exits 1; a failing file load (unresolvable import, require of vitest, missing globals) also exits 1.
