Files
openclaw/src/plugins/cli.browser-plugin.integration.test.ts
Peter Steinberger 98e3f729bc refactor: remove dead plugin loader exports (#105937)
* refactor(plugins): trim activation and contract exports

* test(plugins): restore fixture cleanup

* refactor(plugins): trim install and loader exports

* test(plugins): fully reset loader caches

* refactor(plugins): trim metadata and catalog exports

* test(plugins): preserve catalog trust coverage

* refactor(plugins): trim provider and plugin exports

* refactor(plugins): trim runtime and tool exports

* test(plugins): update dead-export consumers

* test(plugins): remove empty dead-export suites

* refactor(plugins): align exports with split registry

* refactor(plugins): trim drifted loader exports

* style(plugins): format test fixtures

* refactor(scripts): use supported plugin APIs

* refactor(plugins): finish dead export cleanup

* chore(deadcode): refresh export baseline

* test(cli): mock production memory state

* chore(deadcode): sync latest export baseline

* fix(tests): keep plugin fixtures inside core

* chore(deadcode): refresh rebased export baseline

* chore(deadcode): sync current ratchets

* fix(plugins): retain reserved slot invariant

* fix(plugins): preserve dead-export invariants

* test(plugins): use neutral catalog query fixture

* test(plugins): satisfy catalog lint

* test(plugins): preserve integrity drift coverage

* fix(ci): register skill experience live proof
2026-07-13 01:29:33 -07:00

73 lines
2.3 KiB
TypeScript

// Exercises browser plugin CLI integration behavior.
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createBundledBrowserPluginFixture } from "../../test/helpers/browser-bundled-plugin-fixture.js";
import type { OpenClawConfig } from "../config/config.js";
import { clearPluginLoaderCache, loadOpenClawPlugins } from "./loader.test-fixtures.js";
import { resetPluginRuntimeStateForTest } from "./runtime.js";
function resetPluginState() {
clearPluginLoaderCache();
resetPluginRuntimeStateForTest();
}
describe("registerPluginCliCommands browser plugin integration", () => {
let bundledFixture: ReturnType<typeof createBundledBrowserPluginFixture> | null = null;
beforeEach(() => {
bundledFixture = createBundledBrowserPluginFixture();
vi.stubEnv("OPENCLAW_BUNDLED_PLUGINS_DIR", bundledFixture.rootDir);
resetPluginState();
});
afterEach(() => {
resetPluginState();
vi.unstubAllEnvs();
bundledFixture?.cleanup();
bundledFixture = null;
});
it("registers the browser command from the bundled browser plugin", () => {
const registry = loadOpenClawPlugins({
config: {
plugins: {
allow: ["browser"],
},
} as OpenClawConfig,
cache: false,
env: {
...process.env,
OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR:
bundledFixture?.rootDir ?? path.join(process.cwd(), "extensions"),
} as NodeJS.ProcessEnv,
});
expect(registry.cliRegistrars.flatMap((entry) => entry.commands)).toContain("browser");
});
it("omits the browser command when the bundled browser plugin is disabled", () => {
const registry = loadOpenClawPlugins({
config: {
plugins: {
allow: ["browser"],
entries: {
browser: {
enabled: false,
},
},
},
} as OpenClawConfig,
cache: false,
env: {
...process.env,
OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined,
OPENCLAW_BUNDLED_PLUGINS_DIR:
bundledFixture?.rootDir ?? path.join(process.cwd(), "extensions"),
} as NodeJS.ProcessEnv,
});
expect(registry.cliRegistrars.flatMap((entry) => entry.commands)).not.toContain("browser");
});
});