name: Frontend

# Runs the renderer vitest suite. This suite was silently dead for months
# because no workflow executed it (vitest only auto-loads vite.config.ts /
# vitest.config.ts, and the repo had neither until #171) — this job is the
# guard against that happening again.
#
# Typecheck is intentionally NOT run here yet: forge.config.ts and
# update-electron-app carry pre-existing type errors. Add `npm run typecheck`
# once those are fixed.

on:
  push:
    branches: [main]
  pull_request:
    paths:
      - "frontend/**"
      - ".github/workflows/frontend.yml"

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: frontend
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
          cache-dependency-path: frontend/package-lock.json

      - run: npm ci

      - name: Run vitest suite
        run: npx vitest run
