Skip to main content

Testing Guide

Last Verified: 2026-04-11 (PR #465 Jest 29 + React Testing Library migration; PR #515 auth form locators)
Each Equa repository uses a different testing framework. This guide covers how to run tests, how to write new ones, and what coverage is expected.

Testing at a Glance

equa-web Testing

Unit Tests (Jest 29 + React Testing Library)

  • Framework: Jest 29 with @testing-library/react 14 for React component testing (migrated from Enzyme in PR #465)
  • Config: jest.setup.js in project root
  • Test environment: jsdom
  • Test files: *.test.js, *.test.ts, *.test.tsx
  • Location: Colocated with source (e.g., src/shared/components/button/button.test.js)
  • Test count: 52 tests passing
Source: equa-web/package.json scripts and Jest config

E2E Tests (Playwright)

  • Framework: Playwright 1.58
  • Config: playwright.config.ts
  • Test directory: e2e/
  • Base URL: http://localhost:8080
  • Key test files: e2e/google-auth-smoke.spec.ts, e2e/auth-modal-security.spec.ts, e2e/agreements.spec.ts, e2e/regression-fixed-issues.spec.ts, e2e/visual-regression.spec.ts
The webpack dev server starts automatically when running E2E tests.
Auth form locators (PR #515): The login and registration forms render <input type="text">, not <input type="email">. Selectors that target input[type="email"] will silently time out (30s) because the locator never matches. Use input[name="usernameOrEmail"] for the login field and input[name="email"] for the registration email field. See Spec 001 §2.6 for the full form-field contract.
Source: equa-web/package.json scripts; .github/workflows/e2e-tests.yml

equa-server Testing

Integration Tests (Mocha)

  • Framework: Mocha with TypeScript support
  • Config: modules/api/test/.mocharc.js
  • Coverage: NYC (Istanbul)
  • Test location: modules/api/test/
Test directory structure:
Integration tests require a running PostgreSQL database. Start the Docker container first: docker-compose up -d
Source: equa-server/package.json scripts; modules/api/test/ directory structure

equabot-gateway Testing

Unit Tests (Vitest)

  • Framework: Vitest
  • Config: vitest.config.ts
  • Test files: Colocated *.test.ts next to source files
  • Workers: 4-16 locally, 2-3 in CI

E2E and Live Tests

Coverage Requirements

equabot-gateway is the only repo with enforced coverage thresholds:
Source: equabot-gateway/vitest.config.ts coverage configuration

equa-patternlib Testing

  • Framework: Vitest with Testing Library
  • Config: vitest.config.js
  • Environment: jsdom (for React component testing)
  • Test files: Colocated *.test.tsx next to components
Source: equa-patternlib-nextjs/package.json scripts

command-center-so Testing

  • Framework: tsx built-in test runner (Node.js --test)
  • Test location: test/ directory
  • Test files: *.test.ts
E2E tests use Playwright:
Source: command-center-so/package.json scripts

Writing a New Test

Naming Convention

Minimal Test Examples

Vitest (equabot-gateway, equa-patternlib):
Jest + React Testing Library (equa-web):
Mocha (equa-server):

E2E Setup

Before running Playwright E2E tests for the first time, install browsers:
This downloads Chromium, Firefox, and WebKit. Required for both equa-web and command-center-so. Common Playwright commands:

Coverage

Only equabot-gateway will fail CI if coverage drops below thresholds. Other repos generate coverage reports but do not enforce minimums.