test: avoid hoisted cron mock import · openclaw/openclaw@295c30f
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
4 | 4 | import type { CliDeps } from "../cli/deps.js"; |
5 | 5 | import type { OpenClawConfig } from "../config/config.js"; |
6 | 6 | import { SsrFBlockedError } from "../infra/net/ssrf.js"; |
7 | | -import { mergeMockedModule } from "../test-utils/vitest-module-mocks.js"; |
8 | 7 | |
9 | 8 | const { |
10 | 9 | enqueueSystemEventMock, |
@@ -50,14 +49,13 @@ vi.mock("../infra/system-events.js", () => ({
|
50 | 49 | })); |
51 | 50 | |
52 | 51 | vi.mock("../infra/heartbeat-wake.js", async () => { |
53 | | -return await mergeMockedModule( |
54 | | -await vi.importActual<typeof import("../infra/heartbeat-wake.js")>( |
55 | | -"../infra/heartbeat-wake.js", |
56 | | -), |
57 | | -() => ({ |
58 | | - requestHeartbeat, |
59 | | -}), |
| 52 | +const actual = await vi.importActual<typeof import("../infra/heartbeat-wake.js")>( |
| 53 | +"../infra/heartbeat-wake.js", |
60 | 54 | ); |
| 55 | +return { |
| 56 | + ...actual, |
| 57 | + requestHeartbeat, |
| 58 | +}; |
61 | 59 | }); |
62 | 60 | |
63 | 61 | vi.mock("../infra/heartbeat-runner.js", () => ({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。