Features
Testing
Unit tests with Vitest and E2E tests with Playwright.
Unit tests — Vitest
Unit tests live alongside the code they test in __tests__/ directories or with a .test.ts suffix.
Run unit tests:
pnpm test # run once
pnpm test:watch # watch modeExample test:
import { describe, it, expect } from 'vitest'
import { formatDate } from '@/lib/utils'
describe('formatDate', () => {
it('formats a date correctly', () => {
const result = formatDate(new Date('2024-01-15'))
expect(result).toBe('Jan 15, 2024')
})
})E2E tests — Playwright
E2E tests live in e2e/. They run against a real browser and the running app.
Run E2E tests:
pnpm test:e2e # headless
pnpm test:e2e --ui # with Playwright UIExample test:
import { test, expect } from '@playwright/test'
test('user can sign in', async ({ page }) => {
await page.goto('/sign-in')
await page.fill('[name="email"]', 'test@example.com')
await page.fill('[name="password"]', 'password123')
await page.click('[type="submit"]')
await expect(page).toHaveURL('/dashboard')
})CI
Both test suites run automatically on every push via GitHub Actions. See the CI page for details.