Testing
Before opening a pull request, make sure pnpm test and pnpm lint pass. This page explains how to run each kind of test on its own.
Frontend and SDK
Section titled “Frontend and SDK”These run without a database or other services.
pnpm --filter frontend testpnpm --filter cherrypick-js testBackend
Section titled “Backend”There are three kinds of backend tests.
| Kind | Location |
|---|---|
| Unit tests | packages/backend/test/unit |
| Single-server E2E tests | packages/backend/test/e2e |
| Multi-server (federation) E2E tests | packages/backend/test-federation |
Unit tests and single-server E2E tests
Section titled “Unit tests and single-server E2E tests”Copy the test configuration file.
cp .github/cherrypick/test.yml .config/Start PostgreSQL and Redis for testing.
docker compose -f packages/backend/test/compose.yml upAlternatively, prepare an empty database whose data can be erased and edit .config/test.yml.
Run the tests.
pnpm --filter backend test # unit testspnpm --filter backend test:e2e # single-server E2E testsTo run a specific test, pass a path relative to packages/backend.
pnpm --filter backend test test/unit/activitypub.tspnpm --filter backend test:e2e test/e2e/nodeinfo.tsYou can also filter by test name with -t. To re-run on file changes, use pnpm --filter backend vitest-watch.
Multi-server (federation) E2E tests
Section titled “Multi-server (federation) E2E tests”See packages/backend/test-federation/README.md.
Frontend E2E tests
Section titled “Frontend E2E tests”These use Playwright to start a real server and drive it from a browser. Like the backend tests, they need the test database and Redis (.config/test.yml).
pnpm buildpnpm --filter frontend exec playwright install chromiumpnpm start-server-and-test start:test http://localhost:61812 "pnpm --filter frontend test:e2e"start:test starts the server with the settings in .config/test.yml. If a server is already running, you can point to it with the environment variable CHERRYPICK_URL and run only pnpm --filter frontend test:e2e.
Tests run automatically on GitHub Actions. The configuration is in .github/workflows.