mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:10:43 +00:00
test: isolate skills plugin discovery
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { clearPluginDiscoveryCache } from "../plugins/discovery.js";
|
||||
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
|
||||
import { withPathResolutionEnv } from "../test-utils/env.js";
|
||||
import { captureEnv, withPathResolutionEnv } from "../test-utils/env.js";
|
||||
import { createFixtureSuite } from "../test-utils/fixture-suite.js";
|
||||
import { createTempHomeEnv, type TempHomeEnv } from "../test-utils/temp-home.js";
|
||||
import { writeSkill } from "./skills.e2e-test-helpers.js";
|
||||
@@ -33,6 +33,7 @@ vi.mock("./skills/plugin-skills.js", () => ({
|
||||
const fixtureSuite = createFixtureSuite("openclaw-skills-suite-");
|
||||
let tempHome: TempHomeEnv | null = null;
|
||||
let skillsHomeEnv: SkillsHomeEnvSnapshot | null = null;
|
||||
const pluginEnvSnapshot = captureEnv(["OPENCLAW_DISABLE_BUNDLED_PLUGINS"]);
|
||||
|
||||
const resolveTestSkillDirs = (workspaceDir: string) => ({
|
||||
managedSkillsDir: path.join(workspaceDir, ".managed"),
|
||||
@@ -111,6 +112,7 @@ function envSkillSnapshot(name: string, metadata: SkillEntry["metadata"]): Skill
|
||||
|
||||
beforeAll(async () => {
|
||||
await fixtureSuite.setup();
|
||||
process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS = "1";
|
||||
tempHome = await createTempHomeEnv("openclaw-skills-home-");
|
||||
skillsHomeEnv = setMockSkillsHomeEnv(tempHome.home);
|
||||
await fs.mkdir(path.join(tempHome.home, ".openclaw", "agents", "main", "sessions"), {
|
||||
@@ -127,6 +129,7 @@ afterAll(async () => {
|
||||
await tempHome.restore();
|
||||
tempHome = null;
|
||||
}
|
||||
pluginEnvSnapshot.restore();
|
||||
await fixtureSuite.cleanup();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user