mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 16:51:13 +00:00
fix(types): annotate portable exported helper types
This commit is contained in:
@@ -1,38 +1,52 @@
|
||||
import { Command } from "commander";
|
||||
import type { Mock } from "vitest";
|
||||
import { vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { createCliRuntimeCapture } from "./test-runtime-capture.js";
|
||||
|
||||
export const loadConfig = vi.fn<() => OpenClawConfig>(() => ({}) as OpenClawConfig);
|
||||
export const readConfigFileSnapshot = vi.fn();
|
||||
export const writeConfigFile = vi.fn<(config: OpenClawConfig) => Promise<void>>(
|
||||
async () => undefined,
|
||||
);
|
||||
export const replaceConfigFile = vi.fn(
|
||||
type UnknownMock = Mock<(...args: unknown[]) => unknown>;
|
||||
type AsyncUnknownMock = Mock<(...args: unknown[]) => Promise<unknown>>;
|
||||
type LoadConfigFn = (typeof import("../config/config.js"))["loadConfig"];
|
||||
type ParseClawHubPluginSpecFn = (typeof import("../infra/clawhub.js"))["parseClawHubPluginSpec"];
|
||||
type InstallPluginFromMarketplaceFn =
|
||||
(typeof import("../plugins/marketplace.js"))["installPluginFromMarketplace"];
|
||||
type ListMarketplacePluginsFn =
|
||||
(typeof import("../plugins/marketplace.js"))["listMarketplacePlugins"];
|
||||
type ResolveMarketplaceInstallShortcutFn =
|
||||
(typeof import("../plugins/marketplace.js"))["resolveMarketplaceInstallShortcut"];
|
||||
|
||||
function invokeMock<TArgs extends unknown[], TResult>(mock: unknown, ...args: TArgs): TResult {
|
||||
return (mock as (...args: TArgs) => TResult)(...args);
|
||||
}
|
||||
|
||||
export const loadConfig: Mock<LoadConfigFn> = vi.fn<LoadConfigFn>(() => ({}) as OpenClawConfig);
|
||||
export const readConfigFileSnapshot: AsyncUnknownMock = vi.fn();
|
||||
export const writeConfigFile: AsyncUnknownMock = vi.fn(async () => undefined);
|
||||
export const replaceConfigFile: AsyncUnknownMock = vi.fn(
|
||||
async (params: { nextConfig: OpenClawConfig }) => await writeConfigFile(params.nextConfig),
|
||||
);
|
||||
export const resolveStateDir = vi.fn(() => "/tmp/openclaw-state");
|
||||
export const installPluginFromMarketplace = vi.fn();
|
||||
export const listMarketplacePlugins = vi.fn();
|
||||
export const resolveMarketplaceInstallShortcut = vi.fn();
|
||||
export const enablePluginInConfig = vi.fn();
|
||||
export const recordPluginInstall = vi.fn();
|
||||
export const clearPluginManifestRegistryCache = vi.fn();
|
||||
export const buildPluginSnapshotReport = vi.fn();
|
||||
export const buildPluginDiagnosticsReport = vi.fn();
|
||||
export const buildPluginCompatibilityNotices = vi.fn();
|
||||
export const applyExclusiveSlotSelection = vi.fn();
|
||||
export const uninstallPlugin = vi.fn();
|
||||
export const updateNpmInstalledPlugins = vi.fn();
|
||||
export const updateNpmInstalledHookPacks = vi.fn();
|
||||
export const promptYesNo = vi.fn();
|
||||
export const installPluginFromNpmSpec = vi.fn();
|
||||
export const installPluginFromPath = vi.fn();
|
||||
export const installPluginFromClawHub = vi.fn();
|
||||
export const parseClawHubPluginSpec = vi.fn();
|
||||
export const installHooksFromNpmSpec = vi.fn();
|
||||
export const installHooksFromPath = vi.fn();
|
||||
export const recordHookInstall = vi.fn();
|
||||
) as AsyncUnknownMock;
|
||||
export const resolveStateDir: Mock<() => string> = vi.fn(() => "/tmp/openclaw-state");
|
||||
export const installPluginFromMarketplace: Mock<InstallPluginFromMarketplaceFn> = vi.fn();
|
||||
export const listMarketplacePlugins: Mock<ListMarketplacePluginsFn> = vi.fn();
|
||||
export const resolveMarketplaceInstallShortcut: Mock<ResolveMarketplaceInstallShortcutFn> = vi.fn();
|
||||
export const enablePluginInConfig: UnknownMock = vi.fn();
|
||||
export const recordPluginInstall: UnknownMock = vi.fn();
|
||||
export const clearPluginManifestRegistryCache: UnknownMock = vi.fn();
|
||||
export const buildPluginSnapshotReport: UnknownMock = vi.fn();
|
||||
export const buildPluginDiagnosticsReport: UnknownMock = vi.fn();
|
||||
export const buildPluginCompatibilityNotices: UnknownMock = vi.fn();
|
||||
export const applyExclusiveSlotSelection: UnknownMock = vi.fn();
|
||||
export const uninstallPlugin: AsyncUnknownMock = vi.fn();
|
||||
export const updateNpmInstalledPlugins: AsyncUnknownMock = vi.fn();
|
||||
export const updateNpmInstalledHookPacks: AsyncUnknownMock = vi.fn();
|
||||
export const promptYesNo: AsyncUnknownMock = vi.fn();
|
||||
export const installPluginFromNpmSpec: AsyncUnknownMock = vi.fn();
|
||||
export const installPluginFromPath: AsyncUnknownMock = vi.fn();
|
||||
export const installPluginFromClawHub: AsyncUnknownMock = vi.fn();
|
||||
export const parseClawHubPluginSpec: Mock<ParseClawHubPluginSpecFn> = vi.fn();
|
||||
export const installHooksFromNpmSpec: AsyncUnknownMock = vi.fn();
|
||||
export const installHooksFromPath: AsyncUnknownMock = vi.fn();
|
||||
export const recordHookInstall: UnknownMock = vi.fn();
|
||||
|
||||
const { defaultRuntime, runtimeLogs, runtimeErrors, resetRuntimeCapture } =
|
||||
createCliRuntimeCapture();
|
||||
@@ -45,9 +59,28 @@ vi.mock("../runtime.js", () => ({
|
||||
|
||||
vi.mock("../config/config.js", () => ({
|
||||
loadConfig: () => loadConfig(),
|
||||
readConfigFileSnapshot: (...args: unknown[]) => readConfigFileSnapshot(...args),
|
||||
writeConfigFile: (config: OpenClawConfig) => writeConfigFile(config),
|
||||
replaceConfigFile: (params: { nextConfig: OpenClawConfig }) => replaceConfigFile(params),
|
||||
readConfigFileSnapshot: ((
|
||||
...args: Parameters<(typeof import("../config/config.js"))["readConfigFileSnapshot"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../config/config.js"))["readConfigFileSnapshot"]>,
|
||||
ReturnType<(typeof import("../config/config.js"))["readConfigFileSnapshot"]>
|
||||
>(
|
||||
readConfigFileSnapshot,
|
||||
...args,
|
||||
)) as (typeof import("../config/config.js"))["readConfigFileSnapshot"],
|
||||
writeConfigFile: ((config: OpenClawConfig) =>
|
||||
invokeMock<
|
||||
[OpenClawConfig],
|
||||
ReturnType<(typeof import("../config/config.js"))["writeConfigFile"]>
|
||||
>(writeConfigFile, config)) as (typeof import("../config/config.js"))["writeConfigFile"],
|
||||
replaceConfigFile: ((
|
||||
params: Parameters<(typeof import("../config/config.js"))["replaceConfigFile"]>[0],
|
||||
) =>
|
||||
invokeMock<
|
||||
[Parameters<(typeof import("../config/config.js"))["replaceConfigFile"]>[0]],
|
||||
ReturnType<(typeof import("../config/config.js"))["replaceConfigFile"]>
|
||||
>(replaceConfigFile, params)) as (typeof import("../config/config.js"))["replaceConfigFile"],
|
||||
}));
|
||||
|
||||
vi.mock("../config/paths.js", () => ({
|
||||
@@ -55,18 +88,34 @@ vi.mock("../config/paths.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/marketplace.js", () => ({
|
||||
installPluginFromMarketplace: (...args: unknown[]) => installPluginFromMarketplace(...args),
|
||||
listMarketplacePlugins: (...args: unknown[]) => listMarketplacePlugins(...args),
|
||||
resolveMarketplaceInstallShortcut: (...args: unknown[]) =>
|
||||
resolveMarketplaceInstallShortcut(...args),
|
||||
installPluginFromMarketplace: ((...args: Parameters<InstallPluginFromMarketplaceFn>) =>
|
||||
installPluginFromMarketplace(...args)) as InstallPluginFromMarketplaceFn,
|
||||
listMarketplacePlugins: ((...args: Parameters<ListMarketplacePluginsFn>) =>
|
||||
listMarketplacePlugins(...args)) as ListMarketplacePluginsFn,
|
||||
resolveMarketplaceInstallShortcut: ((...args: Parameters<ResolveMarketplaceInstallShortcutFn>) =>
|
||||
resolveMarketplaceInstallShortcut(...args)) as ResolveMarketplaceInstallShortcutFn,
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/enable.js", () => ({
|
||||
enablePluginInConfig: (...args: unknown[]) => enablePluginInConfig(...args),
|
||||
enablePluginInConfig: ((cfg: OpenClawConfig, pluginId: string) =>
|
||||
invokeMock<[OpenClawConfig, string], unknown>(
|
||||
enablePluginInConfig,
|
||||
cfg,
|
||||
pluginId,
|
||||
)) as (typeof import("../plugins/enable.js"))["enablePluginInConfig"],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/installs.js", () => ({
|
||||
recordPluginInstall: (...args: unknown[]) => recordPluginInstall(...args),
|
||||
recordPluginInstall: ((
|
||||
...args: Parameters<(typeof import("../plugins/installs.js"))["recordPluginInstall"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/installs.js"))["recordPluginInstall"]>,
|
||||
ReturnType<(typeof import("../plugins/installs.js"))["recordPluginInstall"]>
|
||||
>(
|
||||
recordPluginInstall,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/installs.js"))["recordPluginInstall"],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
@@ -74,17 +123,59 @@ vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/status.js", () => ({
|
||||
buildPluginSnapshotReport: (...args: unknown[]) => buildPluginSnapshotReport(...args),
|
||||
buildPluginDiagnosticsReport: (...args: unknown[]) => buildPluginDiagnosticsReport(...args),
|
||||
buildPluginCompatibilityNotices: (...args: unknown[]) => buildPluginCompatibilityNotices(...args),
|
||||
buildPluginSnapshotReport: ((
|
||||
...args: Parameters<(typeof import("../plugins/status.js"))["buildPluginSnapshotReport"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/status.js"))["buildPluginSnapshotReport"]>,
|
||||
ReturnType<(typeof import("../plugins/status.js"))["buildPluginSnapshotReport"]>
|
||||
>(
|
||||
buildPluginSnapshotReport,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/status.js"))["buildPluginSnapshotReport"],
|
||||
buildPluginDiagnosticsReport: ((
|
||||
...args: Parameters<(typeof import("../plugins/status.js"))["buildPluginDiagnosticsReport"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/status.js"))["buildPluginDiagnosticsReport"]>,
|
||||
ReturnType<(typeof import("../plugins/status.js"))["buildPluginDiagnosticsReport"]>
|
||||
>(
|
||||
buildPluginDiagnosticsReport,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/status.js"))["buildPluginDiagnosticsReport"],
|
||||
buildPluginCompatibilityNotices: ((
|
||||
...args: Parameters<(typeof import("../plugins/status.js"))["buildPluginCompatibilityNotices"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/status.js"))["buildPluginCompatibilityNotices"]>,
|
||||
ReturnType<(typeof import("../plugins/status.js"))["buildPluginCompatibilityNotices"]>
|
||||
>(
|
||||
buildPluginCompatibilityNotices,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/status.js"))["buildPluginCompatibilityNotices"],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/slots.js", () => ({
|
||||
applyExclusiveSlotSelection: (...args: unknown[]) => applyExclusiveSlotSelection(...args),
|
||||
applyExclusiveSlotSelection: ((
|
||||
params: Parameters<(typeof import("../plugins/slots.js"))["applyExclusiveSlotSelection"]>[0],
|
||||
) =>
|
||||
invokeMock<
|
||||
[Parameters<(typeof import("../plugins/slots.js"))["applyExclusiveSlotSelection"]>[0]],
|
||||
ReturnType<(typeof import("../plugins/slots.js"))["applyExclusiveSlotSelection"]>
|
||||
>(
|
||||
applyExclusiveSlotSelection,
|
||||
params,
|
||||
)) as (typeof import("../plugins/slots.js"))["applyExclusiveSlotSelection"],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/uninstall.js", () => ({
|
||||
uninstallPlugin: (...args: unknown[]) => uninstallPlugin(...args),
|
||||
uninstallPlugin: ((
|
||||
...args: Parameters<(typeof import("../plugins/uninstall.js"))["uninstallPlugin"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/uninstall.js"))["uninstallPlugin"]>,
|
||||
ReturnType<(typeof import("../plugins/uninstall.js"))["uninstallPlugin"]>
|
||||
>(uninstallPlugin, ...args)) as (typeof import("../plugins/uninstall.js"))["uninstallPlugin"],
|
||||
resolveUninstallDirectoryTarget: ({
|
||||
installRecord,
|
||||
}: {
|
||||
@@ -93,33 +184,97 @@ vi.mock("../plugins/uninstall.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/update.js", () => ({
|
||||
updateNpmInstalledPlugins: (...args: unknown[]) => updateNpmInstalledPlugins(...args),
|
||||
updateNpmInstalledPlugins: ((
|
||||
...args: Parameters<(typeof import("../plugins/update.js"))["updateNpmInstalledPlugins"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/update.js"))["updateNpmInstalledPlugins"]>,
|
||||
ReturnType<(typeof import("../plugins/update.js"))["updateNpmInstalledPlugins"]>
|
||||
>(
|
||||
updateNpmInstalledPlugins,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/update.js"))["updateNpmInstalledPlugins"],
|
||||
}));
|
||||
|
||||
vi.mock("../hooks/update.js", () => ({
|
||||
updateNpmInstalledHookPacks: (...args: unknown[]) => updateNpmInstalledHookPacks(...args),
|
||||
updateNpmInstalledHookPacks: ((
|
||||
...args: Parameters<(typeof import("../hooks/update.js"))["updateNpmInstalledHookPacks"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../hooks/update.js"))["updateNpmInstalledHookPacks"]>,
|
||||
ReturnType<(typeof import("../hooks/update.js"))["updateNpmInstalledHookPacks"]>
|
||||
>(
|
||||
updateNpmInstalledHookPacks,
|
||||
...args,
|
||||
)) as (typeof import("../hooks/update.js"))["updateNpmInstalledHookPacks"],
|
||||
}));
|
||||
|
||||
vi.mock("./prompt.js", () => ({
|
||||
promptYesNo: (...args: unknown[]) => promptYesNo(...args),
|
||||
promptYesNo: ((...args: Parameters<(typeof import("./prompt.js"))["promptYesNo"]>) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("./prompt.js"))["promptYesNo"]>,
|
||||
ReturnType<(typeof import("./prompt.js"))["promptYesNo"]>
|
||||
>(promptYesNo, ...args)) as (typeof import("./prompt.js"))["promptYesNo"],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/install.js", () => ({
|
||||
PLUGIN_INSTALL_ERROR_CODE: {
|
||||
NPM_PACKAGE_NOT_FOUND: "npm_package_not_found",
|
||||
},
|
||||
installPluginFromNpmSpec: (...args: unknown[]) => installPluginFromNpmSpec(...args),
|
||||
installPluginFromPath: (...args: unknown[]) => installPluginFromPath(...args),
|
||||
installPluginFromNpmSpec: ((
|
||||
...args: Parameters<(typeof import("../plugins/install.js"))["installPluginFromNpmSpec"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/install.js"))["installPluginFromNpmSpec"]>,
|
||||
ReturnType<(typeof import("../plugins/install.js"))["installPluginFromNpmSpec"]>
|
||||
>(
|
||||
installPluginFromNpmSpec,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/install.js"))["installPluginFromNpmSpec"],
|
||||
installPluginFromPath: ((
|
||||
...args: Parameters<(typeof import("../plugins/install.js"))["installPluginFromPath"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/install.js"))["installPluginFromPath"]>,
|
||||
ReturnType<(typeof import("../plugins/install.js"))["installPluginFromPath"]>
|
||||
>(
|
||||
installPluginFromPath,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/install.js"))["installPluginFromPath"],
|
||||
}));
|
||||
|
||||
vi.mock("../hooks/install.js", () => ({
|
||||
installHooksFromNpmSpec: (...args: unknown[]) => installHooksFromNpmSpec(...args),
|
||||
installHooksFromPath: (...args: unknown[]) => installHooksFromPath(...args),
|
||||
installHooksFromNpmSpec: ((
|
||||
...args: Parameters<(typeof import("../hooks/install.js"))["installHooksFromNpmSpec"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../hooks/install.js"))["installHooksFromNpmSpec"]>,
|
||||
ReturnType<(typeof import("../hooks/install.js"))["installHooksFromNpmSpec"]>
|
||||
>(
|
||||
installHooksFromNpmSpec,
|
||||
...args,
|
||||
)) as (typeof import("../hooks/install.js"))["installHooksFromNpmSpec"],
|
||||
installHooksFromPath: ((
|
||||
...args: Parameters<(typeof import("../hooks/install.js"))["installHooksFromPath"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../hooks/install.js"))["installHooksFromPath"]>,
|
||||
ReturnType<(typeof import("../hooks/install.js"))["installHooksFromPath"]>
|
||||
>(
|
||||
installHooksFromPath,
|
||||
...args,
|
||||
)) as (typeof import("../hooks/install.js"))["installHooksFromPath"],
|
||||
resolveHookInstallDir: (hookId: string) => `/tmp/hooks/${hookId}`,
|
||||
}));
|
||||
|
||||
vi.mock("../hooks/installs.js", () => ({
|
||||
recordHookInstall: (...args: unknown[]) => recordHookInstall(...args),
|
||||
recordHookInstall: ((
|
||||
...args: Parameters<(typeof import("../hooks/installs.js"))["recordHookInstall"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../hooks/installs.js"))["recordHookInstall"]>,
|
||||
ReturnType<(typeof import("../hooks/installs.js"))["recordHookInstall"]>
|
||||
>(recordHookInstall, ...args)) as (typeof import("../hooks/installs.js"))["recordHookInstall"],
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/clawhub.js", () => ({
|
||||
@@ -127,13 +282,31 @@ vi.mock("../plugins/clawhub.js", () => ({
|
||||
PACKAGE_NOT_FOUND: "package_not_found",
|
||||
VERSION_NOT_FOUND: "version_not_found",
|
||||
},
|
||||
installPluginFromClawHub: (...args: unknown[]) => installPluginFromClawHub(...args),
|
||||
installPluginFromClawHub: ((
|
||||
...args: Parameters<(typeof import("../plugins/clawhub.js"))["installPluginFromClawHub"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../plugins/clawhub.js"))["installPluginFromClawHub"]>,
|
||||
ReturnType<(typeof import("../plugins/clawhub.js"))["installPluginFromClawHub"]>
|
||||
>(
|
||||
installPluginFromClawHub,
|
||||
...args,
|
||||
)) as (typeof import("../plugins/clawhub.js"))["installPluginFromClawHub"],
|
||||
formatClawHubSpecifier: ({ name, version }: { name: string; version?: string }) =>
|
||||
`clawhub:${name}${version ? `@${version}` : ""}`,
|
||||
}));
|
||||
|
||||
vi.mock("../infra/clawhub.js", () => ({
|
||||
parseClawHubPluginSpec: (...args: unknown[]) => parseClawHubPluginSpec(...args),
|
||||
parseClawHubPluginSpec: ((
|
||||
...args: Parameters<(typeof import("../infra/clawhub.js"))["parseClawHubPluginSpec"]>
|
||||
) =>
|
||||
invokeMock<
|
||||
Parameters<(typeof import("../infra/clawhub.js"))["parseClawHubPluginSpec"]>,
|
||||
ReturnType<(typeof import("../infra/clawhub.js"))["parseClawHubPluginSpec"]>
|
||||
>(
|
||||
parseClawHubPluginSpec,
|
||||
...args,
|
||||
)) as (typeof import("../infra/clawhub.js"))["parseClawHubPluginSpec"],
|
||||
}));
|
||||
|
||||
const { registerPluginsCli } = await import("./plugins-cli.js");
|
||||
@@ -197,7 +370,8 @@ export function resetPluginsCliTestState() {
|
||||
});
|
||||
writeConfigFile.mockResolvedValue(undefined);
|
||||
replaceConfigFile.mockImplementation(
|
||||
async (params: { nextConfig: OpenClawConfig }) => await writeConfigFile(params.nextConfig),
|
||||
(async (params: { nextConfig: OpenClawConfig }) =>
|
||||
await writeConfigFile(params.nextConfig)) as (...args: unknown[]) => Promise<unknown>,
|
||||
);
|
||||
resolveStateDir.mockReturnValue("/tmp/openclaw-state");
|
||||
resolveMarketplaceInstallShortcut.mockResolvedValue(null);
|
||||
@@ -205,8 +379,12 @@ export function resetPluginsCliTestState() {
|
||||
ok: false,
|
||||
error: "marketplace install failed",
|
||||
});
|
||||
enablePluginInConfig.mockImplementation((cfg: OpenClawConfig) => ({ config: cfg }));
|
||||
recordPluginInstall.mockImplementation((cfg: OpenClawConfig) => cfg);
|
||||
enablePluginInConfig.mockImplementation(((cfg: OpenClawConfig) => ({ config: cfg })) as (
|
||||
...args: unknown[]
|
||||
) => unknown);
|
||||
recordPluginInstall.mockImplementation(
|
||||
((cfg: OpenClawConfig) => cfg) as (...args: unknown[]) => unknown,
|
||||
);
|
||||
const defaultPluginReport = {
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
@@ -214,10 +392,10 @@ export function resetPluginsCliTestState() {
|
||||
buildPluginSnapshotReport.mockReturnValue(defaultPluginReport);
|
||||
buildPluginDiagnosticsReport.mockReturnValue(defaultPluginReport);
|
||||
buildPluginCompatibilityNotices.mockReturnValue([]);
|
||||
applyExclusiveSlotSelection.mockImplementation(({ config }: { config: OpenClawConfig }) => ({
|
||||
applyExclusiveSlotSelection.mockImplementation((({ config }: { config: OpenClawConfig }) => ({
|
||||
config,
|
||||
warnings: [],
|
||||
}));
|
||||
})) as (...args: unknown[]) => unknown);
|
||||
uninstallPlugin.mockResolvedValue({
|
||||
ok: true,
|
||||
config: {} as OpenClawConfig,
|
||||
@@ -260,5 +438,7 @@ export function resetPluginsCliTestState() {
|
||||
ok: false,
|
||||
error: "hook npm install disabled in test",
|
||||
});
|
||||
recordHookInstall.mockImplementation((cfg: OpenClawConfig) => cfg);
|
||||
recordHookInstall.mockImplementation(
|
||||
((cfg: OpenClawConfig) => cfg) as (...args: unknown[]) => unknown,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user