mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:30:42 +00:00
fix: scope runtime plugin preload to effective plugins
This commit is contained in:
@@ -42,6 +42,8 @@ const mocks = vi.hoisted(() => ({
|
||||
>(),
|
||||
resolveChannelPluginIds:
|
||||
vi.fn<typeof import("../plugins/channel-plugin-ids.js").resolveChannelPluginIds>(),
|
||||
resolveEffectivePluginIds:
|
||||
vi.fn<typeof import("../plugins/effective-plugin-ids.js").resolveEffectivePluginIds>(),
|
||||
resolvePluginRuntimeLoadContext:
|
||||
vi.fn<typeof import("../plugins/runtime/load-context.js").resolvePluginRuntimeLoadContext>(),
|
||||
}));
|
||||
@@ -75,6 +77,11 @@ vi.mock("../plugins/channel-plugin-ids.js", () => ({
|
||||
mocks.resolveChannelPluginIds(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/effective-plugin-ids.js", () => ({
|
||||
resolveEffectivePluginIds: (...args: Parameters<typeof mocks.resolveEffectivePluginIds>) =>
|
||||
mocks.resolveEffectivePluginIds(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/runtime/load-context.js", () => ({
|
||||
resolvePluginRuntimeLoadContext: (
|
||||
...args: Parameters<typeof mocks.resolvePluginRuntimeLoadContext>
|
||||
@@ -134,6 +141,7 @@ describe("ensurePluginRegistryLoaded", () => {
|
||||
mocks.resolveConfiguredChannelPluginIds.mockReset();
|
||||
mocks.resolveDiscoverableScopedChannelPluginIds.mockReset();
|
||||
mocks.resolveChannelPluginIds.mockReset();
|
||||
mocks.resolveEffectivePluginIds.mockReset();
|
||||
mocks.resolvePluginRuntimeLoadContext.mockReset();
|
||||
resetPluginRegistryLoadedForTests();
|
||||
|
||||
@@ -141,6 +149,7 @@ describe("ensurePluginRegistryLoaded", () => {
|
||||
mocks.resolveCompatibleRuntimePluginRegistry.mockReturnValue(undefined);
|
||||
mocks.resolveRuntimePluginRegistry.mockReturnValue(undefined);
|
||||
mocks.resolveDiscoverableScopedChannelPluginIds.mockReturnValue([]);
|
||||
mocks.resolveEffectivePluginIds.mockReturnValue(["demo"]);
|
||||
mocks.resolvePluginRuntimeLoadContext.mockImplementation((options) => {
|
||||
const rawConfig = (options?.config ?? {}) as Record<string, unknown>;
|
||||
return {
|
||||
@@ -270,6 +279,7 @@ describe("ensurePluginRegistryLoaded", () => {
|
||||
expect(mocks.loadOpenClawPlugins).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
config,
|
||||
onlyPluginIds: ["demo"],
|
||||
throwOnLoadError: true,
|
||||
workspaceDir: "/tmp/workspace",
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user