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
+10 -1
View File
@@ -2,6 +2,7 @@ import type { AnyAgentTool } from "../agents/tools/common.js";
import type { OpenClawPluginToolContext } from "./types.js";
import { normalizeToolName } from "../agents/tool-policy.js";
import { createSubsystemLogger } from "../logging/subsystem.js";
import { applyTestPluginDefaults, normalizePluginsConfig } from "./config-state.js";
import { loadOpenClawPlugins } from "./loader.js";
const log = createSubsystemLogger("plugins");
@@ -45,8 +46,16 @@ export function resolvePluginTools(params: {
existingToolNames?: Set<string>;
toolAllowlist?: string[];
}): AnyAgentTool[] {
// Fast path: when plugins are effectively disabled, avoid discovery/jiti entirely.
// This matters a lot for unit tests and for tool construction hot paths.
const effectiveConfig = applyTestPluginDefaults(params.context.config ?? {}, process.env);
const normalized = normalizePluginsConfig(effectiveConfig.plugins);
if (!normalized.enabled) {
return [];
}
const registry = loadOpenClawPlugins({
config: params.context.config,
config: effectiveConfig,
workspaceDir: params.context.workspaceDir,
logger: {
info: (msg) => log.info(msg),