From 48eae5f327f777a7d577d337340025fbe8caf5d4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 28 Mar 2026 00:45:06 +0000 Subject: [PATCH] test: isolate browser plugin cli integration --- .../cli.browser-plugin.integration.test.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/plugins/cli.browser-plugin.integration.test.ts b/src/plugins/cli.browser-plugin.integration.test.ts index cd9eafb2c78..a256acf0c40 100644 --- a/src/plugins/cli.browser-plugin.integration.test.ts +++ b/src/plugins/cli.browser-plugin.integration.test.ts @@ -1,10 +1,10 @@ import { Command } from "commander"; -import { afterEach, beforeEach, describe, expect, it } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { OpenClawConfig } from "../config/config.js"; -import { registerPluginCliCommands } from "./cli.js"; -import { clearPluginLoaderCache } from "./loader.js"; -import { clearPluginManifestRegistryCache } from "./manifest-registry.js"; -import { resetPluginRuntimeStateForTest } from "./runtime.js"; +let registerPluginCliCommands: typeof import("./cli.js").registerPluginCliCommands; +let clearPluginLoaderCache: typeof import("./loader.js").clearPluginLoaderCache; +let clearPluginManifestRegistryCache: typeof import("./manifest-registry.js").clearPluginManifestRegistryCache; +let resetPluginRuntimeStateForTest: typeof import("./runtime.js").resetPluginRuntimeStateForTest; function resetPluginState() { clearPluginLoaderCache(); @@ -13,7 +13,14 @@ function resetPluginState() { } describe("registerPluginCliCommands browser plugin integration", () => { - beforeEach(() => { + beforeEach(async () => { + ({ clearPluginLoaderCache } = + await vi.importActual("./loader.js")); + ({ clearPluginManifestRegistryCache } = + await vi.importActual("./manifest-registry.js")); + ({ resetPluginRuntimeStateForTest } = + await vi.importActual("./runtime.js")); + ({ registerPluginCliCommands } = await vi.importActual("./cli.js")); resetPluginState(); });