Isolate plugin hook tests from plugin caches

This commit is contained in:
Tak Hoffman 2026-03-19 00:09:18 -05:00
parent 9cd74ca94b
commit 15fd465a48
No known key found for this signature in database

View File

@ -4,6 +4,8 @@ import os from "node:os";
import path from "node:path";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { clearPluginDiscoveryCache } from "../plugins/discovery.js";
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
import {
clearInternalHooks,
createInternalHookEvent,
@ -24,6 +26,8 @@ describe("bundle plugin hooks", () => {
beforeEach(async () => {
clearInternalHooks();
clearPluginDiscoveryCache();
clearPluginManifestRegistryCache();
workspaceDir = path.join(fixtureRoot, `case-${caseId++}`);
await fsp.mkdir(workspaceDir, { recursive: true });
previousBundledHooksDir = process.env.OPENCLAW_BUNDLED_HOOKS_DIR;
@ -32,6 +36,8 @@ describe("bundle plugin hooks", () => {
afterEach(() => {
clearInternalHooks();
clearPluginDiscoveryCache();
clearPluginManifestRegistryCache();
if (previousBundledHooksDir === undefined) {
delete process.env.OPENCLAW_BUNDLED_HOOKS_DIR;
} else {