Skip to main content
The project uses Jest for unit testing across all packages and the mobile app.

Running tests

Run all tests

Run tests across the entire workspace:
bun test

Run package tests

Run tests for all packages only:
bun test:unit:packages

Run mobile app tests

Run tests for the mobile app:
bun test:unit:mobile
Mobile tests currently require additional React Native/Expo setup and are skipped by default.

Run tests for a specific package

Run tests for an individual package:
bun test:unit <package>:test
Examples:
bun test:unit theme:test
bun test:unit config:test
bun test:unit notifications:test

Test configuration

Each package has its own test configuration:
  • jest.config.ts - Package-specific Jest configuration
  • tsconfig.spec.json - TypeScript configuration for test files
  • Root jest.preset.js - Shared Jest configuration for all packages

Writing tests

Test file naming

Test files should use one of these extensions:
  • .test.ts - TypeScript tests
  • .spec.ts - TypeScript spec files
  • .test.tsx - React component tests
  • .spec.tsx - React component spec files

Test file location

Place test files next to the code they test:
packages/theme/src/
  lib/
    theme.ts
    theme.test.ts  ← Test file

Example test

import { amisiConfig } from './config';

describe('config', () => {
  it('should export valid config', () => {
    expect(amisiConfig).toBeDefined();
    expect(amisiConfig.branding).toBeDefined();
    expect(amisiConfig.theme).toBeDefined();
  });
});

Coverage reports

Test coverage reports are generated in:
coverage/packages/<package-name>/
To view coverage, run tests and open the generated HTML report:
bun test:unit <package>:test
open coverage/packages/<package-name>/lcov-report/index.html

Continuous integration

The verify script runs linting, type checking, and tests on affected projects:
bun verify
This is used in CI to ensure code quality before merging.