oclaw/openclaw/test/helpers/AGENTS.md
oliver dbbe3add6a 重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。

Made-with: Cursor
2026-04-26 08:34:33 +08:00

1.3 KiB

Shared Test Helper Boundary

This directory holds shared test helpers reused by core and bundled plugin tests.

Bundled Plugin Imports

  • Shared helpers in this tree must not hardcode repo-relative imports into extensions/**.
  • When a helper needs a bundled plugin public surface, go through src/test-utils/bundled-plugin-public-surface.ts.
  • Prefer loadBundledPluginApiSync(...), loadBundledPluginRuntimeApiSync(...), loadBundledPluginContractApiSync(...), and loadBundledPluginTestApiSync(...) for eager access to exported surfaces.
  • Prefer resolveRelativeBundledPluginPublicModuleId(...) or resolveBundledPluginPublicModulePath(...) when a helper needs a module id or filesystem path for dynamic import, mocking, or loading a plugin entrypoint such as index.js.
  • If vi.hoisted(...) is involved, do not call imported helper functions from inside the hoisted callback. Resolve the module id outside the callback or switch to vi.doMock(...).
  • Do not keep plugin-local deep mocks or private src/** knowledge in shared helpers. Move those helpers into the owning bundled plugin package instead.

Intent

  • Keep shared helpers aligned with the same public/plugin boundary that production code uses.
  • Avoid shared helper debt that makes core test lanes depend on bundled plugin private layout.