test(slashcommand): isolate command-loader cache between tests

This commit is contained in:
Sisyphus
2026-04-18 14:53:14 +09:00
parent 0ca571e74d
commit 61675adbf1
3 changed files with 9 additions and 0 deletions
@@ -2,6 +2,7 @@ import { describe, expect, it, beforeEach, afterEach, spyOn, mock } from "bun:te
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs"
import { tmpdir } from "node:os"
import { join } from "node:path"
import { clearCommandLoaderCache } from "../../features/claude-code-command-loader"
import type { LoadedSkill } from "../../features/opencode-skill-loader/types"
import type {
AutoSlashCommandHookInput,
@@ -43,6 +44,7 @@ describe("createAutoSlashCommandHook", () => {
let createAutoSlashCommandHook: AutoSlashCommandModule["createAutoSlashCommandHook"]
beforeEach(async () => {
clearCommandLoaderCache()
mock.restore()
logCalls = []
spyOn(shared, "log").mockImplementation((message: string, data?: unknown) => {
@@ -56,6 +58,7 @@ describe("createAutoSlashCommandHook", () => {
})
afterEach(() => {
clearCommandLoaderCache()
process.chdir(originalWorkingDirectory)
rmSync(tempDir, { recursive: true, force: true })
mock.restore()