mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 22:45:41 +00:00
4f9ad07d65
* test(frontend): expand harness for store/component/contract tests
- factories: makeSubsonicSong, makeServer, makeAuthState, makeQueueState
- storeReset.ts: per-test reset for player/auth/preview/orbit stores
- mocks/subsonic.ts: realistic fixtures + stream/cover URL helpers
- mocks/browser.ts: ResizeObserver/IntersectionObserver/matchMedia/clipboard/object URLs
- mocks/tauri.ts: tauriMockListenerCount for listener-lifecycle regression tests
- renderWithProviders: pin i18n language to 'en' by default; { language } opt-out
- vitest.config: pool 'forks' + isolate to avoid module-mock + Zustand-global flake
- README: documented patterns, store-reset policy, i18n rule, isolation rationale
* test(frontend): bump utility coverage + expand hot-path gate
serverMagicString: 71→100% (encode/decode rejection branches, clipboard
fallback paths). shareLink: 69→97% (all entity kinds, queue trim, orbit
decoder, findServerIdForShareUrl). dynamicColors: 44→100% (extractCoverColors
DOM paths via Image / canvas / fetch mocks).
Gate adds shareLink.ts and dynamicColors.ts — both stable above 95%.
Comments updated for the new floor and the M4 hard-gate handoff.
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'node:path';
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
test: {
|
|
// jsdom by default — most new tests touch the DOM or React state. Pure
|
|
// utility tests work fine in jsdom too, so we keep a single environment.
|
|
environment: 'jsdom',
|
|
globals: false,
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
include: ['src/**/*.test.{ts,tsx}'],
|
|
exclude: [
|
|
'node_modules/**',
|
|
'dist/**',
|
|
'src-tauri/**',
|
|
],
|
|
// Process isolation. Fake timers + module-level mocks + Zustand globals
|
|
// collide unpredictably across files inside a shared worker — forks +
|
|
// isolate gives each file a fresh module graph. ~20% slower locally,
|
|
// worth it well before the suite hits 30 files. See the pre-refactor
|
|
// testing plan (2026-05-11) §3 for the decision context.
|
|
pool: 'forks',
|
|
isolate: true,
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'json-summary', 'html', 'lcov'],
|
|
reportsDirectory: './coverage',
|
|
include: ['src/**/*.{ts,tsx}'],
|
|
exclude: [
|
|
'src/**/*.test.{ts,tsx}',
|
|
'src/**/*.d.ts',
|
|
'src/test/**',
|
|
'src/main.tsx',
|
|
'src/vite-env.d.ts',
|
|
],
|
|
// Soft thresholds — Phase 0 is infra, not coverage push. Real numbers
|
|
// land in Phase 1 once cucadmuh and Frank lock the gate.
|
|
thresholds: {
|
|
lines: 0,
|
|
functions: 0,
|
|
branches: 0,
|
|
statements: 0,
|
|
},
|
|
},
|
|
},
|
|
});
|