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 { afterEach, beforeEach, describe, expect, it } from "bun:test"
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 { executeSlashCommand } from "./executor"
const ENV_KEYS = [
@@ -95,6 +96,7 @@ describe("auto-slash command executor plugin dispatch", () => {
let envSnapshot: EnvSnapshot
beforeEach(() => {
clearCommandLoaderCache()
tempDir = mkdtempSync(join(tmpdir(), "omo-executor-plugin-test-"))
envSnapshot = {
CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR,
@@ -106,6 +108,7 @@ describe("auto-slash command executor plugin dispatch", () => {
})
afterEach(() => {
clearCommandLoaderCache()
for (const key of ENV_KEYS) {
const previousValue = envSnapshot[key]
if (previousValue === undefined) {