Testing & CI
Orchard has a series of tests to ensure the codebase is formatted and functions as expected:
- Unit tests for both the server and the client.
- Formatting and linting.
- CI pipeline that runs the same checks on every pull request.
Unit tests
Section titled “Unit tests”Run everything at once:
npm run testThis runs the server tests, then the client tests. You can also run each side on its own.
Server (Jest)
Section titled “Server (Jest)”Server tests use Jest. Specs live next to the code they cover, as *.spec.ts
files under src/server.
| Command | What it does |
|---|---|
npm run test:server | Run the server tests once. |
npm run test:server:watch | Re-run on change. |
npm run test:server:cov | Run with a coverage report. |
npm run test:debug | Run with the Node inspector attached. |
Client (Karma)
Section titled “Client (Karma)”Client tests use Karma with Jasmine, run in headless Chrome. Specs are *.spec.ts
files under src/client.
npm run test:clientFormatting and linting
Section titled “Formatting and linting”npm run format # format with Prettiernpm run format:check # check formatting without writing changesnpm run lint # lint with ESLintnpm run lint:fix # lint and auto-fixCI runs format:check and lint, so run them before pushing.
Continuous integration
Section titled “Continuous integration”CI is a GitHub Actions workflow at .github/workflows/ci.yml. It runs on every
push and pull request to master, and can also be triggered manually. There is
one job, quality-check, on ubuntu-latest, which runs these steps in order:
- Install dependencies with
npm ci. - Install Chrome (for the client tests).
npm run format:checknpm run lintnpm run generate:typesnpm run testnpm run build- Upload the built
distas an artifact.
The Node version comes from .nvmrc. Running format:check, lint, and test
locally before you push mirrors what CI checks.
Other workflows
Section titled “Other workflows”Two more workflows build Docker images rather than run tests:
| Workflow | Trigger | What it does |
|---|---|---|
image-release.yml | A published GitHub release | Builds and pushes multi-architecture images to the GitHub Container Registry. |
image-snapshot.yml | Manual dispatch | Builds snapshot images on demand. |
Development Testing & CI
Last updated: