Checks & tests ​
Every package has the same commands:
| Command | What it does |
|---|---|
yarn format:check | Checks formatting with Prettier |
yarn format:write | Formats every file in the package. Changes files |
yarn check:ts | Type checks |
yarn test | Runs the package's tests |
yarn ready | Formats, type checks and tests: what CI will check |
CI runs the checks for each package a merge request touches, and every check before anything is released. Before pushing, run the checks for what you changed, with the SDK built and synced first:
sh
yarn --cwd sdk check:ts && yarn --cwd sdk test
yarn --cwd backend check:ts && yarn --cwd backend test
yarn --cwd frontend check:ts && yarn --cwd frontend build
yarn --cwd mobile check:ts && yarn --cwd mobile check:bundleBackend tests ​
yarn test runs the Mocha suite against an in-memory SQLite database, rebuilt before each test, so tests run one at a time. It stops at the first failure; yarn test:all doesn't.
The tests need Redis, and empty it before every test. Point them at a database of their own so they never wipe your development data:
sh
REDIS_URL=redis://localhost:6669/15 yarn --cwd backend testRun one file with yarn mocha tests/api/channel.test.ts, or filter with yarn test --grep "pattern".
Web app tests ​
| Command | What it runs |
|---|---|
yarn test:unit | Unit tests in tests/unit/, with Node's built-in test runner |
yarn test | Playwright end-to-end tests against a real backend, started with a fresh E2E database |
yarn test:regression | Playwright tests of the real components against a mocked server. Doesn't touch your development data |
Set PLAYWRIGHT_CHANNEL=chrome to use your installed Chrome instead of Playwright's browsers.
Code style ​
Prettier, in every package: double quotes, semicolons, trailing commas, 120-character lines and 2-space indents. Comments explain why, not what; match the density of the code around them.