From dfc30afc0900a905d85b3f3a1f1624459f117061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Thu, 12 Nov 2026 19:05:00 +0000 Subject: [PATCH] Tests take away the commands and agents they write into the shared config directory Co-Authored-By: Claude Fable 5.2 --- tests/project.test.ts | 8 ++++++-- tests/subagent.test.ts | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/project.test.ts b/tests/project.test.ts index 9ab6956..890f3d2 100644 --- a/tests/project.test.ts +++ b/tests/project.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, test } from "bun:test" -import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs" +import { afterAll, describe, expect, test } from "bun:test" +import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from "node:fs" import { tmpdir } from "node:os" import { join } from "node:path" import { paths } from "../src/config/paths.ts" @@ -9,6 +9,10 @@ import { customCommands, expandCommand } from "../src/project/commands.ts" import { FileIndex } from "../src/project/files.ts" import { findProject, projectDirName } from "../src/project/root.ts" +// The whole suite shares one config directory: what this file puts under commands/ is taken away +// again, or every later start-up warns about it. +afterAll(() => rmSync(join(paths.config, "commands"), { recursive: true, force: true })) + function tree() { const root = mkdtempSync(join(tmpdir(), "ph-proj-")) mkdirSync(join(root, "src/deep"), { recursive: true }) diff --git a/tests/subagent.test.ts b/tests/subagent.test.ts index 3486218..4dafa79 100644 --- a/tests/subagent.test.ts +++ b/tests/subagent.test.ts @@ -1,5 +1,5 @@ -import { afterEach, describe, expect, test } from "bun:test" -import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs" +import { afterAll, afterEach, describe, expect, test } from "bun:test" +import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from "node:fs" import { tmpdir } from "node:os" import { join } from "node:path" import { createApp } from "../src/app.ts" @@ -9,6 +9,10 @@ import { createView } from "../src/tui/state.ts" import { MARKS } from "../src/jobs/note.ts" import { delta, fakeProvider, toolCall, type Fake } from "./fake-provider.ts" +// The whole suite shares one config directory: what this file puts under agents/ is taken away +// again, or every later start-up warns about it. +afterAll(() => rmSync(join(paths.config, "agents"), { recursive: true, force: true })) + let fake: Fake | undefined let other: Fake | undefined afterEach(() => (fake?.stop(), other?.stop(), (other = undefined)))