This monorepo uses Nx for orchestrating tests across all packages. Each package has its own testing requirements and infrastructure.
To run tests for any package:
# Basic pattern
npx nx test <package-name>
# Examples
npx nx test auth-js
npx nx test:storage storage-js # Special command for storage-js
npx nx test postgrest-jsEach package has unique testing requirements. Please refer to the individual README files for detailed instructions:
| Package | Docker Required | Test Command | Documentation |
|---|---|---|---|
| auth-js | ✅ Yes (GoTrue + PostgreSQL) | npx nx test:auth auth-js |
Testing Guide |
| functions-js | ✅ Yes (Deno relay via testcontainers) | npx nx test functions-js |
Testing Guide |
| postgrest-js | ✅ Yes (PostgREST + PostgreSQL) | npx nx test postgrest-js |
Testing Guide |
| realtime-js | ❌ No (uses mock WebSockets) | npx nx test realtime-js |
Testing Guide |
| storage-js | ✅ Yes (Storage API + PostgreSQL + Kong) | npx nx test:storage storage-js |
Testing Guide |
| supabase-js | ❌ No (unit tests only) | npx nx test supabase-js |
Testing Guide |
# Run tests with coverage
npx nx test <package> --coverage
# Run tests in watch mode
npx nx test <package> --watch
# Run all tests across the monorepo
npx nx run-many --target=test --all- Node.js 18+ - Required for all packages
- Docker - Required for auth-js, functions-js, postgrest-js, and storage-js
- Ports - Various packages use different ports for test infrastructure (see individual READMEs)
In CI environments, tests are run automatically using GitHub Actions. The CI pipeline:
- Sets up Node.js and Docker
- Installs dependencies
- Runs tests for all affected packages
- Generates coverage reports
For CI-specific test commands, many packages have a test:ci target that includes coverage reporting.
For package-specific issues, consult the troubleshooting section in each package's README. Common issues:
- Port conflicts: Check if required ports are already in use
- Docker not running: Ensure Docker Desktop is started
- Container cleanup: Use
npx nx test:clean <package>if containers weren't properly removed
When adding new features or fixing bugs:
- Write tests that cover your changes
- Ensure all existing tests pass
- Update test documentation if you change testing infrastructure
- Follow the testing patterns established in each package
For more details on contributing, see CONTRIBUTING.md.