Testing Vitni
Vitni uses Vitest for unit and API integration tests and Playwright for browser end-to-end and screenshot comparison tests.
Test layers
Section titled “Test layers”Run tests by layer from the repository root:
corepack pnpm test:unitcorepack pnpm test:integrationcorepack pnpm test:e2ecorepack pnpm test:visualtest:unit checks credential construction and evidence validation. test:integration verifies the CMS HTTP contract and starts the real API against the configured PostgreSQL database. It requires the local .env, PostgreSQL, and applied migrations; it only checks health and unauthenticated access on the real API. The controller-level tests use isolated Nest test modules.
test:e2e starts Nuxt and Starlight development servers on their normal local ports (13000 and 4321) when they are not already running. It checks the public site, sign-in boundary for workspace/CMS routes, and documentation routes. It does not require an identity-provider test account.
Visual baselines
Section titled “Visual baselines”Playwright compares the website and documentation homepage screenshots against the committed images next to the browser tests. Run corepack pnpm test:visual:update only after reviewing an intentional visual change. Keep baseline generation and comparison on the same operating system and browser version because font rendering can vary between platforms. See the Playwright visual comparison guide.
Install the browser once if Playwright reports that Chromium is missing:
corepack pnpm exec playwright install chromiumRun the full suite with corepack pnpm test. The real API integration test requires the local database services and a working .env; unit and controller tests can run without starting Vitni’s services.