perf(test): reuse plugin validation fixtures

This commit is contained in:
Peter Steinberger
2026-04-23 11:04:07 +01:00
parent d634380304
commit 9191fbe2b5
2 changed files with 7 additions and 9 deletions

View File

@@ -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();

View File

@@ -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"]);