mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-02 21:01:51 +00:00
fix: stabilize plugin-sdk test loading
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { Command } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { afterAll, afterEach, beforeEach, describe, expect, it } 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";
|
||||
|
||||
const previousPreferDistPluginSdk = process.env.OPENCLAW_PLUGIN_SDK_PREFER_DIST;
|
||||
process.env.OPENCLAW_PLUGIN_SDK_PREFER_DIST = "1";
|
||||
|
||||
function resetPluginState() {
|
||||
clearPluginLoaderCache();
|
||||
clearPluginManifestRegistryCache();
|
||||
@@ -21,6 +24,14 @@ describe("registerPluginCliCommands browser plugin integration", () => {
|
||||
resetPluginState();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (previousPreferDistPluginSdk === undefined) {
|
||||
delete process.env.OPENCLAW_PLUGIN_SDK_PREFER_DIST;
|
||||
} else {
|
||||
process.env.OPENCLAW_PLUGIN_SDK_PREFER_DIST = previousPreferDistPluginSdk;
|
||||
}
|
||||
});
|
||||
|
||||
it("registers the browser command from the bundled browser plugin", () => {
|
||||
const program = new Command();
|
||||
registerPluginCliCommands(program, {
|
||||
|
||||
Reference in New Issue
Block a user