mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
02d533e949
* test(frontend): vitest framework bootstrap + hot-path file coverage gate
Adds the harness for component, hook and store tests on top of the existing
util tests in src/utils/. Mirrors the backend rust-tests rollout: jsdom env,
v8 coverage, soft hot-path file gate, dedicated CI workflow.
What's in:
- vitest.config.ts: jsdom environment, v8 coverage, alias @ -> src
- src/test/setup.ts: jest-dom, @testing-library cleanup, vi.mock for
@tauri-apps/api/{core,event} + plugin-shell, Map-backed Storage polyfill
for Node 25 + jsdom 26 (both ship a broken native localStorage)
- src/test/mocks/tauri.ts: programmable onInvoke() / emitTauriEvent() helpers,
auto-reset between tests
- src/test/helpers/factories.ts: makeTrack / makeTracks
- src/test/helpers/renderWithProviders.tsx: render() wrapped with
MemoryRouter + I18nextProvider
- src/test/README.md: conventions doc (where tests go, how to mock Tauri,
what to never mock)
Sample tests showing the patterns:
- src/components/CoverLightbox.test.tsx: component, queries by role
- src/store/previewStore.test.ts: store characterization, event handlers
+ stopPreview (startPreview deferred until the cross-store provider
strategy is decided)
CI:
- .github/workflows/frontend-tests.yml: jobs for vitest, tsc, coverage +
hot-path gate. coverage job carries continue-on-error: true (soft).
- .github/frontend-hot-path-files.txt: initial list (3 utils at >=70%).
playerStore + the unfinished half of previewStore are deferred until
Phase 1 coverage work lands.
- scripts/check-frontend-hot-path-coverage.sh: mirror of the rust gate.
npm scripts:
- test: one-shot run (unchanged)
- test⌚ vitest in watch mode
- test:coverage: v8 coverage + html / lcov / json-summary reports
57 / 57 tests pass; tsc --noEmit clean.
* chore(nix): sync npmDepsHash with package-lock.json
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
29 lines
1.6 KiB
Plaintext
29 lines
1.6 KiB
Plaintext
# Hot-path source files for the per-file ≥70 % coverage gate (frontend).
|
|
#
|
|
# Mirrors `.github/hot-path-files.txt` for the Rust crates. Each entry is a
|
|
# workspace-relative path; the gate script (`scripts/check-frontend-hot-path-
|
|
# coverage.sh`) reads `coverage/coverage-summary.json` produced by
|
|
# `vitest run --coverage` and warns when a listed file drops below the floor.
|
|
#
|
|
# Soft today (warnings only — the workflow carries `continue-on-error: true`).
|
|
# Flip to a hard PR-blocker by removing `continue-on-error` from the
|
|
# `frontend-tests` workflow once a few PRs have run cleanly.
|
|
#
|
|
# Curation rule (mirrors the backend list): a file belongs here when its
|
|
# hot-path code dominates the file and ≥70 % is a reasonable floor. Files
|
|
# that are partially covered today but contain large untested surface area
|
|
# (e.g. `playerStore.ts`, the unfinished half of `previewStore.ts`) live
|
|
# OUTSIDE the gate until their tests grow. Add them as Phase 1 coverage
|
|
# work lands.
|
|
#
|
|
# Deferred from the gate, with current coverage shown for reference:
|
|
# - src/store/previewStore.ts (33 % — only `_on*` + `stopPreview` covered)
|
|
# - src/store/playerStore.ts (0 % — 3300-LOC monolith, Phase 2 target)
|
|
# - src/utils/dynamicColors.ts (44 % — existing tests miss branches)
|
|
# - src/utils/shareLink.ts (69 % — borderline, ~5 lines short)
|
|
|
|
# ── utils (already at or above threshold) ────────────────────────────
|
|
src/utils/coverArtRegisteredSizes.ts
|
|
src/utils/serverDisplayName.ts
|
|
src/utils/serverMagicString.ts
|