Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(tests): restore watch restarts in claim worktrees (#13103)

Adam Eivya0a71049cb0f
diff --git a/client/vitest.config.js b/client/vitest.config.js
index 16fbc0d844..78d2d1082e 100644
--- a/client/vitest.config.js
+++ b/client/vitest.config.js
@@ -2,6 +2,7 @@ import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from 'node:url';
import { bootstrapVitestTempRoot } from '../scripts/lib/vitestTempRoot.js';
+import { VITEST_WATCH_OPTIONS } from '../scripts/lib/vitestWatch.js';
import { CLIENT_TEST_EXCLUDE, CLIENT_TEST_INCLUDE } from '../scripts/lib/workspaceTests.js';
import { applyRunnerSelection, vitestCiPool, vitestRunnerSelection } from '../scripts/vitestCiPool.js';
@@ -10,6 +11,7 @@ import { TEST_TIMEOUT_MS } from './src/test/timeouts.js';
const RUN_TEMP_ROOT = bootstrapVitestTempRoot();
const config = defineConfig({
+ server: { watch: VITEST_WATCH_OPTIONS },
// Anchor to the config, even when --root or the caller cwd differs.
cacheDir: fileURLToPath(new URL('./.cache/vitest', import.meta.url)),
plugins: [react()],
diff --git a/scripts/lib/vitestWatch.js b/scripts/lib/vitestWatch.js
new file mode 100644
index 0000000000..717b586a52
--- /dev/null
+++ b/scripts/lib/vitestWatch.js
@@ -0,0 +1,8 @@
+import { fileURLToPath } from 'node:url';
+
+export const VITEST_WATCH_OPTIONS = {
+ // Native macOS fsevents can reach idle without delivering config edits (#13103).
+ useFsEvents: false,
+ // Anchor to THIS checkout: **/data/** would also ignore claim-worktree source.
+ ignored: [fileURLToPath(new URL('../../data/', import.meta.url)).replaceAll('\\', '/') + '**'],
+};
diff --git a/server/vitest.config.db.js b/server/vitest.config.db.js
index 28abacc338..9827292bef 100644
--- a/server/vitest.config.db.js
+++ b/server/vitest.config.db.js
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
import { applyRunnerSelection, vitestRunnerSelection } from '../scripts/vitestCiPool.js';
import { DB_TEST_INCLUDE } from '../scripts/lib/dbTestFiles.js';
import { bootstrapVitestTempRoot } from '../scripts/lib/vitestTempRoot.js';
+import { VITEST_WATCH_OPTIONS } from '../scripts/lib/vitestWatch.js';
// This independent runner owns the same fixture/browser scratch as npm test.
const RUN_TEMP_ROOT = bootstrapVitestTempRoot();
@@ -44,6 +45,7 @@ export { DB_TEST_INCLUDE } from '../scripts/lib/dbTestFiles.js';
* checkHealth consumer is left out.
*/
const config = defineConfig({
+ server: { watch: VITEST_WATCH_OPTIONS },
// Anchor to the config, even when --root or the caller cwd differs.
cacheDir: fileURLToPath(new URL('./.cache/vitest-db', import.meta.url)),
test: {
diff --git a/server/vitest.config.js b/server/vitest.config.js
index 6bb84d6d97..16358a0e86 100644
--- a/server/vitest.config.js
+++ b/server/vitest.config.js
@@ -2,6 +2,7 @@ import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'node:url';
import { applyRunnerSelection, vitestCaptureProjects, vitestCiPool, vitestRunnerSelection } from '../scripts/vitestCiPool.js';
import { bootstrapVitestTempRoot } from '../scripts/lib/vitestTempRoot.js';
+import { VITEST_WATCH_OPTIONS } from '../scripts/lib/vitestWatch.js';
import { SERVER_TEST_EXCLUDE, SERVER_TEST_INCLUDE, browserOwnerExcludes } from '../scripts/lib/workspaceTests.js';
// `npm run test:fast` is the Windows-safe way to set the flag (a
@@ -44,6 +45,7 @@ process.env.NODE_DISABLE_COMPILE_CACHE = '1';
const runnerSelection = vitestRunnerSelection();
const config = defineConfig({
+ server: { watch: VITEST_WATCH_OPTIONS },
// Anchor to the config, even when --root or the caller cwd differs.
cacheDir: fileURLToPath(new URL('./.cache/vitest', import.meta.url)),
test: {