Initial Upload
Some checks failed
CI / Lint & Typecheck (push) Has been cancelled
CI / Test (routes) (push) Has been cancelled
CI / Test (security) (push) Has been cancelled
CI / Test (services) (push) Has been cancelled
CI / Test (unit) (push) Has been cancelled
CI / Test (integration) (push) Has been cancelled
CI / Test Coverage (push) Has been cancelled
CI / Build (push) Has been cancelled

This commit is contained in:
2025-12-17 12:32:50 +13:00
commit 3015f48118
471 changed files with 141143 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
/**
* Main Vitest Configuration
*
* Runs ALL tests when using `pnpm test` or `pnpm test:coverage`.
* For targeted test runs, use the group-specific configs:
*
* pnpm test:unit - Pure functions (utils, parsers, schemas)
* pnpm test:services - Business logic (services, jobs)
* pnpm test:routes - API endpoints (routes with mocked DB)
* pnpm test:security - Auth/authz behavior tests
*
* Integration tests use a separate config:
* pnpm test:integration - Real DB tests (vitest.integration.config.ts)
*/
import { defineConfig, mergeConfig } from 'vitest/config';
import { sharedConfig } from './vitest.shared.js';
export default mergeConfig(
sharedConfig,
defineConfig({
test: {
// Run all unit + security tests (excludes integration)
include: ['src/**/*.test.ts'],
exclude: ['**/node_modules/**', '**/dist/**', '**/*.integration.test.ts'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'json-summary', 'html', 'lcov'],
reportsDirectory: './coverage',
include: [
'src/services/**/*.ts',
'src/routes/**/*.ts',
'src/jobs/**/*.ts',
'src/utils/**/*.ts',
],
exclude: [
'**/*.test.ts',
'**/test/**',
// Type-only files with no executable code
'**/types.ts',
// Index files that only register routes (no business logic)
'**/routes/**/index.ts',
'**/routes/auth/index.ts',
'**/routes/stats/index.ts',
'**/routes/users/index.ts',
// HTTP client wrappers tested via integration tests
'**/services/mediaServer/plex/client.ts',
'**/services/mediaServer/plex/eventSource.ts',
'**/services/mediaServer/jellyfin/client.ts',
'**/services/mediaServer/emby/client.ts',
],
thresholds: {
statements: 42,
branches: 36,
functions: 48,
lines: 42,
},
},
},
})
);