Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Stop dev-server full reloads when test files are saved

rcourtmanef19e64b280a
diff --git a/frontend-modern/vite.config.ts b/frontend-modern/vite.config.ts
index f707a5daa4..44e1e5ccbf 100644
--- a/frontend-modern/vite.config.ts
+++ b/frontend-modern/vite.config.ts
@@ -45,7 +45,7 @@ const proxyOriginOverride = process.env.PULSE_DEV_PROXY_ORIGIN ?? '';
const srcAlias = path.resolve(__dirname, './src');
-export default defineConfig({
+export default defineConfig(({ mode }) => ({
plugins: [solid(), sri({ algorithm: 'sha384' })],
resolve: {
alias: {
@@ -57,6 +57,15 @@ export default defineConfig({
port: frontendDevPort,
host: frontendDevHost,
strictPort: true,
+ // Test files are not part of the client app, but once anything requests
+ // one through the dev server it enters the client module graph, and every
+ // later save of it dead-ends HMR into a full page reload for all connected
+ // clients. Parallel agents save test files constantly, so ignore them in
+ // the dev watcher. Scoped off test mode so vitest watch re-runs still see
+ // file changes.
+ ...(mode === 'test'
+ ? {}
+ : { watch: { ignored: ['**/__tests__/**', '**/*.test.ts', '**/*.test.tsx'] } }),
proxy: {
'/ws': {
target: backendWsUrl,
@@ -284,4 +293,4 @@ export default defineConfig({
'**/tests/integration/**',
],
},
-});
+}));