test: isolate harness registry state · openclaw/openclaw@0d4b693
shakkernerd
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import { afterEach, describe, expect, it, vi } from "vitest"; |
| 1 | +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 2 | import type { OpenClawConfig } from "../../config/types.openclaw.js"; |
3 | 3 | import { |
4 | 4 | clearAgentHarnesses, |
@@ -16,6 +16,10 @@ import type { AgentHarness } from "./types.js";
|
16 | 16 | |
17 | 17 | const originalRuntime = process.env.OPENCLAW_AGENT_RUNTIME; |
18 | 18 | |
| 19 | +beforeEach(() => { |
| 20 | +clearAgentHarnesses(); |
| 21 | +}); |
| 22 | + |
19 | 23 | afterEach(() => { |
20 | 24 | clearAgentHarnesses(); |
21 | 25 | if (originalRuntime == null) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import type { Api, Model } from "@mariozechner/pi-ai"; |
2 | | -import { afterEach, describe, expect, it, vi } from "vitest"; |
| 2 | +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
3 | 3 | import type { OpenClawConfig } from "../../config/config.js"; |
4 | 4 | import type { |
5 | 5 | EmbeddedRunAttemptParams, |
@@ -26,6 +26,10 @@ vi.mock("./builtin-pi.js", () => ({
|
26 | 26 | |
27 | 27 | const originalRuntime = process.env.OPENCLAW_AGENT_RUNTIME; |
28 | 28 | |
| 29 | +beforeEach(() => { |
| 30 | +clearAgentHarnesses(); |
| 31 | +}); |
| 32 | + |
29 | 33 | afterEach(() => { |
30 | 34 | clearAgentHarnesses(); |
31 | 35 | piRunAttempt.mockClear(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。