@@ -4,6 +4,7 @@ import { EventEmitter } from "node:events";
44import fs from "node:fs/promises" ;
55import os from "node:os" ;
66import path from "node:path" ;
7+ import { createPluginRuntimeMock } from "openclaw/plugin-sdk/plugin-test-runtime" ;
78import { resetInboundDedupe } from "openclaw/plugin-sdk/reply-runtime" ;
89import { resetLogger , setLoggerOverride } from "openclaw/plugin-sdk/runtime-env" ;
910import { mockPinnedHostnameResolution } from "openclaw/plugin-sdk/test-env" ;
@@ -13,6 +14,7 @@ import type { WebInboundMessageInput, WebListenerCloseReason } from "./inbound.j
1314import type { WhatsAppSendResult } from "./inbound/send-result.js" ;
1415import { createAcceptedWhatsAppSendResult as createAcceptedWhatsAppSendResultForHarness } from "./inbound/send-result.test-helper.js" ;
1516import { createTestWebInboundMessage } from "./inbound/test-message.test-helper.js" ;
17+ import { setWhatsAppRuntime } from "./runtime.js" ;
1618import {
1719 resetBaileysMocks as _resetBaileysMocks ,
1820 resetLoadConfigMock as _resetLoadConfigMock ,
@@ -224,6 +226,8 @@ export function installWebAutoReplyUnitTestHooks(opts?: { pinDns?: boolean }) {
224226 resetWebAutoReplySessionSockets ( ) ;
225227 _resetBaileysMocks ( ) ;
226228 _resetLoadConfigMock ( ) ;
229+ // Scoped test files must seed the plugin slot instead of inheriting another file's runtime.
230+ setWhatsAppRuntime ( createPluginRuntimeMock ( ) ) ;
227231 if ( opts ?. pinDns ) {
228232 resolvePinnedHostnameSpy = mockPinnedHostnameResolution ( [ TEST_NET_IP ] ) ;
229233 }
0 commit comments