Files
DECNET/decnet_web/vite.config.ts
anti 171e20e427 refactor(decnet_web/Config): wire hook + bump coverage floor
Final integration. The page shell is now a thin composition of
useConfig + the previously-extracted children:

- Config.tsx: 989 -> 131 LOC. Page owns only the activeTab state
  (and the "drop the users tab if the server didn't send users"
  effect). Every form lives inside its tab; toast wiring lives
  in AppearanceTab; window.alert calls live inside UsersTab.
- Tabs receive their `onSave* / onAddUser / ...` callbacks
  directly from the hook — no intermediate wrapper handlers.

Coverage floor bumped after the split:

  lines       14 -> 17
  functions   13 -> 15
  branches    11 -> 13
  statements  13 -> 16

Phase 4 final scoreboard: 34 test files, 156 tests, all green.
2026-05-09 05:27:47 -04:00

64 lines
2.1 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test/setup.ts'],
css: false,
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
include: ['src/**/*.{ts,tsx}'],
exclude: ['src/**/*.d.ts', 'src/test/**', 'src/main.tsx'],
// Baseline floors. Each refactor PR raises these; never lower.
// Phase 4 (Config split): page shell down from 989 to 131 LOC;
// hook + WorkersPanel + 4 tab files, 25 new tests. Suite:
// 34 files, 156 tests, 17.73% lines / 13.85% branches.
thresholds: {
lines: 17,
functions: 15,
branches: 13,
statements: 16,
},
},
},
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:8000',
changeOrigin: true,
},
},
},
build: {
// Split heavy third-party libs into their own chunks so the main
// bundle stays small and the rarely-changing vendor code stays
// cacheable across deploys. Recharts + asciinema-player + lucide
// together made up most of the weight that was tripping the 500kB
// warning.
rollupOptions: {
output: {
manualChunks: (id: string) => {
if (!id.includes('node_modules')) return undefined
// d3-* ships alongside recharts as its plotting engine —
// grouping them keeps tree-shaken subsets together.
if (id.includes('recharts') || id.includes('/d3-')) return 'charts'
if (id.includes('asciinema-player')) return 'player'
if (id.includes('lucide-react')) return 'icons'
if (id.includes('react-router')) return 'router'
if (id.includes('react-dom')) return 'react-dom'
if (id.includes('/react/') || id.endsWith('/react')) return 'react'
return 'vendor'
},
},
},
// Legitimate ceiling for any single chunk after splitting; anything
// larger is a real bloat regression worth investigating.
chunkSizeWarningLimit: 600,
},
})