Files
fusion/packages/core/vitest.config.ts
Fusion fa0cbe2327 feat(FN-2387): unify agents view loading through useAgents
- Move AgentsView to consume agents, loading state, and reload logic directly from useAgents
- Extend useAgents with filterState/showSystemAgents options and always pass includeEphemeral in fetch filters
- Remove duplicate initial fetch/SSE path in AgentsView and rely on hook-managed refresh behavior
- Add regression coverage for single initial load and system-agent visibility toggling behavior
- Update useAgents hook tests to assert the new includeEphemeral fetch contract
2026-04-24 08:54:25 -07:00

42 lines
1.6 KiB
TypeScript

import { defineConfig } from "vitest/config";
import { resolve } from "node:path";
import { cpus } from "node:os";
// Keep worker fan-out conservative by default. Over-subscribing threads can
// starve Vitest's worker RPC channel and trigger flaky "onTaskUpdate" timeouts
// under heavy SQLite test load.
const defaultMaxWorkers = Math.min(4, Math.max(1, cpus().length - 1));
const requestedMaxWorkers = Number.parseInt(process.env.VITEST_MAX_WORKERS ?? String(defaultMaxWorkers), 10);
const maxWorkers = Math.max(1, Number.isFinite(requestedMaxWorkers) ? requestedMaxWorkers : defaultMaxWorkers);
process.env.VITEST_MAX_WORKERS = String(maxWorkers);
export default defineConfig({
resolve: {
alias: {
"@fusion/test-utils": resolve(__dirname, "./src/__test-utils__/workspace.ts"),
},
},
test: {
include: ["src/**/*.test.ts"],
setupFiles: [
"./src/__tests__/setup-test-isolation.ts",
"./src/__test-utils__/vitest-setup.ts",
],
globalSetup: ["./src/__test-utils__/vitest-teardown.ts"],
maxWorkers,
poolOptions: { threads: { minThreads: 1, maxThreads: maxWorkers }, forks: { minForks: 1, maxForks: maxWorkers } },
fileParallelism: true,
// Core runs a large SQLite-heavy suite while other workspace packages test concurrently.
// Use a slightly higher timeout to reduce nondeterministic slow-machine flakes.
testTimeout: 15_000,
hookTimeout: 15_000,
coverage: {
enabled: false,
reporter: ["text", "html", "json"],
reportsDirectory: "./coverage",
include: ["src/**/*.ts"],
exclude: ["**/*.test.ts", "**/*.d.ts", "dist/**"],
},
},
});