From 9191fbe2b5148e3c5b4b624dbce7cdabaa5bb8fc Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 23 Apr 2026 11:04:07 +0100 Subject: [PATCH] perf(test): reuse plugin validation fixtures --- src/config/config.plugin-validation.test.ts | 8 +------- src/config/plugin-auto-enable.core.test.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/config/config.plugin-validation.test.ts b/src/config/config.plugin-validation.test.ts index 0ee193e2350..2ccc5156e98 100644 --- a/src/config/config.plugin-validation.test.ts +++ b/src/config/config.plugin-validation.test.ts @@ -1,7 +1,7 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; -import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest"; +import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { validateConfigObjectWithPlugins } from "./validation.js"; @@ -109,7 +109,6 @@ describe("config plugin validation", () => { OPENCLAW_HOME: undefined, OPENCLAW_STATE_DIR: path.join(suiteHome, ".openclaw"), OPENCLAW_PLUGIN_MANIFEST_CACHE_MS: "10000", - OPENCLAW_DISABLE_PLUGIN_DISCOVERY_CACHE: "1", OPENCLAW_BUNDLED_PLUGINS_DIR: undefined, OPENCLAW_VERSION: undefined, VITEST: "true", @@ -228,11 +227,6 @@ describe("config plugin validation", () => { }); }); - afterEach(() => { - vi.restoreAllMocks(); - clearPluginManifestRegistryCache(); - }); - afterAll(async () => { await fs.rm(fixtureRoot, { recursive: true, force: true }); clearPluginManifestRegistryCache(); diff --git a/src/config/plugin-auto-enable.core.test.ts b/src/config/plugin-auto-enable.core.test.ts index 44a30201bfe..1f397085157 100644 --- a/src/config/plugin-auto-enable.core.test.ts +++ b/src/config/plugin-auto-enable.core.test.ts @@ -365,7 +365,7 @@ describe("applyPluginAutoEnable core", () => { }); it("preserves configured plugin entries in restrictive plugins.allow", () => { - const result = applyPluginAutoEnable({ + const result = materializePluginAutoEnableCandidates({ config: { plugins: { allow: ["glueclaw"], @@ -378,7 +378,9 @@ describe("applyPluginAutoEnable core", () => { }, }, }, + candidates: [], env, + manifestRegistry: makeRegistry([{ id: "discord", channels: [] }]), }); expect(result.config.plugins?.allow).toEqual(["glueclaw", "discord"]); @@ -386,7 +388,7 @@ describe("applyPluginAutoEnable core", () => { }); it("does not preserve stale configured plugin entries in restrictive plugins.allow", () => { - const result = applyPluginAutoEnable({ + const result = materializePluginAutoEnableCandidates({ config: { plugins: { allow: ["glueclaw"], @@ -399,7 +401,9 @@ describe("applyPluginAutoEnable core", () => { }, }, }, + candidates: [], env, + manifestRegistry: makeRegistry([]), }); expect(result.config.plugins?.allow).toEqual(["glueclaw"]);