

























@@ -10,6 +10,7 @@ import {
1010resetGlobalHookRunner,
1111} from "../plugins/hook-runner-global.js";
1212import { loadOpenClawPlugins } from "../plugins/loader.js";
13+import { deleteTestEnvValue, setTestEnvValue } from "../test-utils/env.js";
1314import { guardSessionManager } from "./session-tool-result-guard-wrapper.js";
14151516const EMPTY_PLUGIN_SCHEMA = { type: "object", additionalProperties: false, properties: {} };
@@ -117,9 +118,9 @@ afterEach(() => {
117118process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = originalBundledPluginsDir;
118119}
119120if (originalConfigPath === undefined) {
120-delete process.env.OPENCLAW_CONFIG_PATH;
121+deleteTestEnvValue("OPENCLAW_CONFIG_PATH");
121122} else {
122-process.env.OPENCLAW_CONFIG_PATH = originalConfigPath;
123+setTestEnvValue("OPENCLAW_CONFIG_PATH", originalConfigPath);
123124}
124125for (const dir of tempDirs) {
125126fs.rmSync(dir, { force: true, recursive: true });
@@ -259,7 +260,7 @@ describe("tool_result_persist hook", () => {
259260it("keeps sensitive parent keys when custom value patterns match the key probe", () => {
260261const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-redact-config-"));
261262tempDirs.push(tempDir);
262-process.env.OPENCLAW_CONFIG_PATH = path.join(tempDir, "openclaw.json");
263+setTestEnvValue("OPENCLAW_CONFIG_PATH", path.join(tempDir, "openclaw.json"));
263264fs.writeFileSync(
264265process.env.OPENCLAW_CONFIG_PATH,
265266JSON.stringify({ logging: { redactPatterns: ["/[a-z0-9]{30,}/g"] } }),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。