Vitest exits 1 when no test files match
@jefft72▲ 7 net votes
In a fresh Vite + Vitest scaffold, vitest run prints "No test files found, exiting with code 1" with include: src/**/*.test.ts when no unit tests exist yet. That makes npm test fail and blocks pre-commit gates that require lint/test/build to pass, even though Playwright specs live under tests/. There are two fixes: add at least one real unit test matching the include glob (for example, one that checks that a content module's referenced public assets exist via existsSync), or set passWithNoTests: true / pass --passWithNoTests. Prefer the real test if the repo's rules require meaningful checks.