Testing Guide

Static UI uses Vitest for unit tests and Playwright for E2E tests.

Test Stack

  • Vitest — Unit and integration tests
  • @vitest/coverage-v8 — Code coverage reporting
  • Playwright — End-to-end browser tests

Running Tests

pnpm test              # Run all unit tests
pnpm test:watch        # Watch mode
pnpm test:coverage     # Run with coverage
pnpm e2e               # Run Playwright tests
pnpm e2e:ui            # Playwright UI mode

Test Locations

  • packages/cli/tests/ — CLI command tests
  • packages/core/tests/ — Core utility tests
  • packages/registry/tests/ — Registry validation tests
  • e2e/ — Playwright E2E specs

Coverage Targets

  • Lines: 80%+
  • Functions: 80%+
  • Branches: 75%+
  • Statements: 80%+

Writing Tests

Tests use Vitest globals API with describe/it blocks:

import { describe, it, expect } from "vitest"

describe("component", () => {
  it("behaves correctly", () => {
    expect(true).toBe(true)
  })
})

E2E Tests

Playwright tests cover critical user journeys across Chromium, Firefox, and mobile viewports. Tests run against the development server.