perf(test): speed up vitest by skipping plugins + LLM slug

This commit is contained in:
Peter Steinberger
2026-02-07 07:57:50 +00:00
parent 626a1d0699
commit 9f507112b5
6 changed files with 61 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent
import { loadConfig } from "../config/config.js";
import { createSubsystemLogger } from "../logging.js";
import { loadOpenClawPlugins } from "../plugins/loader.js";
import { getActivePluginRegistry } from "../plugins/runtime.js";
const log = createSubsystemLogger("plugins");
let pluginRegistryLoaded = false;
@@ -11,6 +12,16 @@ export function ensurePluginRegistryLoaded(): void {
if (pluginRegistryLoaded) {
return;
}
const active = getActivePluginRegistry();
// Tests (and callers) can pre-seed a registry (e.g. `test/setup.ts`); avoid
// doing an expensive load when we already have plugins/channels/tools.
if (
active &&
(active.plugins.length > 0 || active.channels.length > 0 || active.tools.length > 0)
) {
pluginRegistryLoaded = true;
return;
}
const config = loadConfig();
const workspaceDir = resolveAgentWorkspaceDir(config, resolveDefaultAgentId(config));
const logger: PluginLogger = {