Files
sofarr/vitest.config.js
T
gronod 6c4aedf60e
Build and Push Docker Image / build (push) Successful in 1m57s
Docs Check / Markdown lint (push) Failing after 2m21s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 3m11s
CI / Security audit (push) Successful in 3m44s
CI / Swagger Validation & Coverage (push) Successful in 4m4s
Docs Check / Mermaid diagram parse check (push) Successful in 4m37s
CI / Tests & coverage (push) Successful in 8m29s
chore: bump version to 1.7.36 and update CHANGELOG and docs
2026-05-29 13:37:56 +01:00

54 lines
2.2 KiB
JavaScript

// Copyright (c) 2026 Gordon Bolton. MIT License.
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// Global test helpers (describe, it, expect, vi) without per-file imports
globals: true,
// Increase test timeout to avoid transient timeouts under coverage/heavy loads
testTimeout: 15000,
// Run test files sequentially to avoid cross-test background event pollution
fileParallelism: false,
// Run each test file in an isolated module registry so module-level state
// (tokenStore cache, config singletons) doesn't leak between files
isolate: true,
// Give each file its own data directory so tokenStore file I/O doesn't collide
setupFiles: ['./tests/setup.js'],
// Environment configuration based on test type
environmentMatchGlobs: [
// Server tests use node environment (must come first - more specific)
['tests/unit/**/*.js', 'node'],
['tests/integration/**/*.js', 'node'],
// Frontend tests need jsdom for DOM APIs (broader pattern comes last)
['tests/frontend/**/*.js', 'jsdom']
],
// Coverage via V8 (built into Node — no babel transform needed)
coverage: {
provider: 'v8',
reporter: ['text', 'lcov', 'html'],
reportsDirectory: './coverage',
// Only measure coverage on production source files
include: ['server/**/*.js'],
exclude: [
'server/index.js', // entry point with side-effects (process.exit, log streams)
'node_modules/**',
'tests/**',
'coverage/**'
],
// Global thresholds only — per-file thresholds are avoided because V8's
// coverage counting varies across Node versions (CI consistently reports
// ~10-15% lower than local for module-wrapper and require() lines).
// Thresholds updated after adding integration tests for dashboard.js,
// emby.js, sonarr.js, radarr.js, and sabnzbd.js. The SSE /stream
// endpoint and poller.js remain untested so thresholds are set
// conservatively to avoid CI flap from V8 coverage variance.
thresholds: {
lines: 55,
functions: 55,
branches: 40,
statements: 55
}
}
}
});