diff --git a/test/collections-config.test.ts b/test/collections-config.test.ts index 3d961d1..b6b15fe 100644 --- a/test/collections-config.test.ts +++ b/test/collections-config.test.ts @@ -23,6 +23,8 @@ beforeEach(() => { }); afterEach(() => { + // Reset index name to default (prevents leaking into other test files under bun test) + setConfigIndexName("index"); for (const [key, val] of Object.entries(savedEnv)) { if (val === undefined) { delete process.env[key]; diff --git a/test/mcp.test.ts b/test/mcp.test.ts index 881874d..e09df8b 100644 --- a/test/mcp.test.ts +++ b/test/mcp.test.ts @@ -16,6 +16,7 @@ import { join } from "node:path"; import { tmpdir } from "node:os"; import YAML from "yaml"; import type { CollectionConfig } from "../src/collections"; +import { setConfigIndexName } from "../src/collections"; // ============================================================================= // Test Database Setup @@ -206,6 +207,9 @@ describe("MCP Server", () => { // Use shared singleton to avoid creating multiple instances with separate GPU resources getDefaultLlamaCpp(); + // Reset index name in case another test file mutated it (bun test shares process) + setConfigIndexName("index"); + // Set up test config directory const configPrefix = join(tmpdir(), `qmd-mcp-config-${Date.now()}-${Math.random().toString(36).slice(2)}`); testConfigDir = await mkdtemp(configPrefix);