ci: run the frontend vitest suite on pull requests#172
Conversation
The renderer suite was dead for months with nothing noticing — no workflow executed it (and until #171 it could not even run: vitest auto-loads only vite.config.ts / vitest.config.ts, which the repo lacked). This job keeps the revived suite alive. Typecheck is intentionally left out until the pre-existing forge.config / update-electron-app type errors are fixed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The committed lock was missing dozens of entries (ansi-regex, error-ex, minimatch, ...), so `npm ci` under CI's npm 10 hard-fails with "Missing: <pkg> from lock file" — the new Frontend workflow caught it on its first run. Newer local npm versions tolerated the drift, which is why it went unnoticed. Regenerated with npm install (npm 10.9.8, lockfileVersion 3) and validated with a clean `npm ci` + full vitest run (9/9 files, 99/99 tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Greptile SummaryAdds a
Confidence Score: 4/5Safe to merge — introduces a new CI workflow with no production code changes; the two findings are cosmetic/consistency issues that do not affect correctness. The workflow correctly guards the vitest suite and uses pinned actions, minimal permissions, and a proper cache path. The push trigger is missing a paths filter (runs on all main pushes), and npx vitest run bypasses the npm test script, but neither causes incorrect CI behavior today. .github/workflows/frontend.yml — the push trigger and test invocation are worth a quick look; frontend/package-lock.json is a routine lockfile update. Important Files Changed
Sequence DiagramsequenceDiagram
participant GH as GitHub
participant Runner as ubuntu-latest Runner
participant Node as Node 20
participant Vitest as npx vitest run
GH->>Runner: "Trigger on PR (frontend/**) or push to main"
Runner->>Runner: "actions/checkout@v4"
Runner->>Node: "actions/setup-node@v4 (Node 20, npm cache)"
Node-->>Runner: Node ready, cache restored
Runner->>Runner: npm ci (in frontend/)
Runner->>Vitest: npx vitest run
Vitest-->>Runner: 9/9 files, 99/99 tests pass or fail
Runner-->>GH: Job result
Reviews (2): Last reviewed commit: "fix(frontend): regenerate package-lock.j..." | Re-trigger Greptile |
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| paths: | ||
| - "frontend/**" | ||
| - ".github/workflows/frontend.yml" |
There was a problem hiding this comment.
The
push trigger on main has no paths filter, so this job runs on every push to main regardless of which files were changed (e.g., a backend-only or docs-only commit). The sibling go.yml workflow sets a paths filter for its push trigger to avoid this. Adding the same filter here would keep CI consistent and avoid burning runner minutes on unrelated pushes.
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| paths: | |
| - "frontend/**" | |
| - ".github/workflows/frontend.yml" | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "frontend/**" | |
| - ".github/workflows/frontend.yml" | |
| pull_request: | |
| paths: | |
| - "frontend/**" | |
| - ".github/workflows/frontend.yml" |
| - name: Run vitest suite | ||
| run: npx vitest run |
There was a problem hiding this comment.
The
test script in package.json already maps to vitest run ("test": "vitest run"), so npm test is the conventional interface here. Using npx vitest run bypasses the package.json script contract — if the test invocation ever gains flags or env-vars via package.json (e.g., coverage flags, reporters), CI would silently not pick them up.
| - name: Run vitest suite | |
| run: npx vitest run | |
| - name: Run vitest suite | |
| run: npm test |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
What
Adds a
Frontendworkflow that runsnpx vitest runon every PR touchingfrontend/**(and on pushes to main).Why
The renderer test suite rotted to 2/9 runnable files with nothing noticing, because no CI workflow ever executed it — found during the post-merge QA pass. #171 revived the suite (9/9 files, 99/99 tests); this job is the guard that keeps it alive.
Typecheck is deliberately not included yet:
forge.config.tsandupdate-electron-appcarry pre-existing type errors (documented in #171). Addnpm run typecheckto this job once those are fixed.Verification
Simulated the job locally with a clean
npm ci+npx vitest run: 9/9 test files, 99/99 tests pass.🤖 Generated with Claude Code