mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 15:01:41 +03:00
perf(test): speed up vitest by skipping plugins + LLM slug
This commit is contained in:
+10
-1
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user