Unit and integration tests with Vitest, end-to-end tests with Playwright
EdgeURL uses two testing frameworks:
npm run testRun all unit tests oncenpm run test:watchRun tests in watch mode (re-runs on file changes)npm run test:uiOpen Vitest UI in browser for interactive testingnpm run test:coverageRun tests with V8 coverage report (text, JSON, HTML)Vitest is configured in vitest.config.ts at the project root:
Test files live in tests/__tests__/ mirroring the source directory structure. Globals mode is enabled, so you do not need to import describe, it, or expect.
The setup file at tests/setup.ts runs before all tests. It configures environment mocks, sets up test fixtures, and initializes any required test infrastructure.
npm run test:e2eRun all E2E testsnpm run test:e2e:uiOpen Playwright UI for interactive debuggingPlaywright is configured in playwright.config.ts:
E2E tests run across 5 browser configurations:
E2E test files live in tests/e2e/. Playwright automatically starts the dev server before running tests.
Use .test.ts for unit/integration tests and .spec.ts for E2E tests.
Use the @/ alias for imports in test files, matching the application code style.
Each test should be independent. Do not rely on test execution order. Use setup and teardown hooks for shared state.
Mock Supabase, Stripe, Redis, and other external dependencies in unit tests. Use the setup file for common mocks.