Pitfall: Vitest Includes Playwright E2E Tests (Recurring)¶
Severity: Medium — causes false test failures in CI
Times reverted: 3+ (as of 2026-04-11)
Root cause: vitest.config.ts has no exclude for tests/e2e/ and tests/integration/
The Problem¶
The tests/e2e/ directory contains Playwright tests (@playwright/test). The tests/integration/ directory contains DB integration tests that need a live PostgreSQL connection. Vitest cannot run either — Playwright tests crash on import, integration tests fail with connection errors.
When npx vitest run is invoked without exclusions, these directories are picked up and reported as failures, masking real unit test results.
Why This Keeps Getting Reverted¶
Sessions that regenerate or modify vitest.config.ts (e.g., Stryker configuration, coverage changes, config cleanup) tend to drop the exclude block because it looks like it could be simplified or was accidentally added. It's not — it's load-bearing.
The Fix¶
vitest.config.ts must always have:
How to Run Each Test Type¶
| Type | Command | Needs |
|---|---|---|
| Unit tests | npx vitest run |
Nothing (mocked) |
| E2E tests | npx playwright test |
Running admin-ui server |
| Integration tests | npx vitest run tests/integration/ |
Live PostgreSQL |
Detection¶
If you see errors like TestTypeImpl._currentSuite or @playwright/test in vitest output, the exclusion has been reverted.