Where tests live and how they resolve paths.
A test that covers one workspace lives in that workspace's tests/ folder, never next to the source. A test that imports from several workspaces goes in tests/integration/cross-package/<area>/. Browser flows go in tests/e2e/saas/, and database checks go in supabase/tests/database/ as pgTAP.
Import setup files and helpers from @workspace/test-fixtures. Keep that package free of internal workspace dependencies, because workspaces depend on it and anything else creates a cycle.
Tests run from different working directories under Turbo, Vitest projects and editors. Build file paths from import.meta.dirname, not process.cwd(). When a test reads a schema file, include its domain folder, for example supabase/schemas/platform/058_functions_audit_log.sql.
pnpm test runs everything through Turbo. pnpm test:unit, pnpm test:integration, pnpm test:e2e and pnpm supabase:test run one layer. Inside a workspace, pnpm exec vitest run <file> runs a single file.
Last updated on