




















@@ -17,6 +17,7 @@ import {
1717createChannelTestPluginBase,
1818createTestRegistry,
1919} from "../../test-utils/channel-plugins.js";
20+import { deleteTestEnvValue, setTestEnvValue } from "../../test-utils/env.js";
2021import { handleAllowlistCommand } from "./commands-allowlist.js";
2122import type { HandleCommandsParams } from "./commands-types.js";
2223import type { ConfigSnapshotMock } from "./commands.test-harness.js";
@@ -256,15 +257,15 @@ async function withTempConfigPath<T>(
256257const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-allowlist-config-"));
257258const configPath = path.join(dir, "openclaw.json");
258259const previous = process.env.OPENCLAW_CONFIG_PATH;
259-process.env.OPENCLAW_CONFIG_PATH = configPath;
260+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
260261await fs.writeFile(configPath, JSON.stringify(initialConfig, null, 2), "utf-8");
261262try {
262263return await run(configPath);
263264} finally {
264265if (previous === undefined) {
265-delete process.env.OPENCLAW_CONFIG_PATH;
266+deleteTestEnvValue("OPENCLAW_CONFIG_PATH");
266267} else {
267-process.env.OPENCLAW_CONFIG_PATH = previous;
268+setTestEnvValue("OPENCLAW_CONFIG_PATH", previous);
268269}
269270await fs.rm(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
270271}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。