Files
ersatztv/web/vite.config.ts
T
timothyandtimothy 8aeacd534a
Build ErsatzTV Image / CI toolchain image resolves (push) Successful in 9s
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 21s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 8m52s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m23s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 5m50s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 5m5s
fix(819): derive the SPA page-size guard population from the git index (#875)
The guard asserted EXACT completeness over a population enumerated by a directory
walk, so an untracked .ts/.tsx under web/src/ entered it and failed as unregistered
on that developer's checkout while CI — which only ever checks out tracked files —
stayed green.

The glob still supplies file CONTENT; the POPULATION is now the git index, read by
web/vite-plugins/trackedSourceFiles.ts in Vite's own Node context and handed to the
app project as a virtual module. That reaches the index without admitting
@types/node to tsconfig.app.json, the obstacle that deferred this in #818.

Three mechanisms carry the proof, each added because the previous was measured
insufficient: a closed-form restatement of the shared scope predicate (sharing no
helper at any depth with what it checks); a second independent `ls-files --others`
query cross-checking the population; and real-git tests that execute the derivation
against a temp repository.

Six residuals are stated with their MEASURED fail-directions, and
testing.guard-derives-population-from-source gains a bounded exception plus the
closed-form criterion.

fixes #819

Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
2026-08-29 09:14:15 +00:00

49 lines
1.7 KiB
TypeScript

import { fileURLToPath, URL } from 'node:url';
import react from '@vitejs/plugin-react';
import { configDefaults, defineConfig } from 'vitest/config';
import { trackedSourceFilesPlugin } from './vite-plugins/trackedSourceFiles';
const aspNetHost = 'http://localhost:8409';
export default defineConfig({
base: '/app/',
plugins: [react(), trackedSourceFilesPlugin()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@design-system': fileURLToPath(new URL('../design-system', import.meta.url))
}
},
build: {
outDir: '../ErsatzTV/wwwroot/app',
emptyOutDir: true
},
server: {
port: 5173,
strictPort: false,
proxy: {
'/api': aspNetHost,
'/iptv': aspNetHost,
'/artwork': aspNetHost
}
},
test: {
environment: 'jsdom',
environmentOptions: {
jsdom: {
url: 'http://localhost/app/'
}
},
// `e2e/` holds the Playwright UI-E2E specs (ersatztv#445), which drive a REAL browser against a
// running instance. Vitest's default `include` glob (`**/*.{test,spec}.*`) would otherwise pick
// them up and run them under jsdom, where `@playwright/test`'s `test()` has no runner and the
// whole file dies. Spread the defaults rather than replacing `exclude` outright — a bare
// `exclude: ['e2e/**']` would drop `**/node_modules/**` and make vitest crawl deps.
// NOTE: excluding (not narrowing `include` to `src/**`) is deliberate — `scripts/` holds a real
// vitest test too (`generate-openapi-types.test.mjs`), which an `src/**`-only include would
// silently stop running.
exclude: [...configDefaults.exclude, 'e2e/**'],
setupFiles: './src/setupTests.ts'
}
});