Skip to content

Testing

Comprehensive testing setup with Vitest for unit tests and Playwright for end-to-end tests. Both tools are pre-configured and ready to use out of the box.

Key features

  • Unit tests for Node and DOM environments
  • Component testing with React Testing Library
  • End-to-end tests with Playwright
  • Smoke tests for deployed environments
  • Coverage reports
Terminal window
bun run test # Run all unit tests
bun run test:watch # Run tests in watch mode
bun run test:coverage # Run tests with coverage report
bun run test:e2e # Run end-to-end tests
bun run test:e2e:ui # Run e2e tests with interactive UI
bun run test:smoke # Run smoke tests against deployed URL

Unit tests verify individual functions, components, and modules in isolation. They run fast and catch bugs early in development. Vitest is configured with two separate environments:

EnvironmentFile PatternUse Case
Node*.test.tsServer-side logic, utilities, API handlers
DOM (happy-dom)*.test.tsxReact components, hooks, client-side code

Tests are co-located with their source files. Component tests use React Testing Library for rendering and interacting with components.

End-to-end tests verify complete user flows by automating a real browser. They test the full application stack-frontend, backend, and database-ensuring everything works together correctly. E2E tests are located in the e2e/ directory and use Playwright. Tests automatically start the development server when running locally.

Smoke tests are lightweight checks that run against deployed environments to verify a deployment succeeded. They test critical paths like page loading and basic functionality. Smoke tests (*.smoke.spec.ts) are triggered automatically in CI after deployment.

Run them locally against a deployed environment:

Terminal window
TEST_PAGE_URL=https://your-app.pages.dev bun run test:smoke