

























@@ -5,7 +5,7 @@ import path from "node:path";
55import JSON5 from "json5";
66import { beforeAll, describe, expect, it } from "vitest";
77import { clearConfigCache, clearRuntimeConfigSnapshot } from "../config/config.js";
8-import { captureEnv } from "../test-utils/env.js";
8+import { captureEnv, deleteTestEnvValue, setTestEnvValue } from "../test-utils/env.js";
99import { runConfigSet } from "./config-cli.js";
10101111function createTestRuntime() {
@@ -91,8 +91,8 @@ async function withExecDryRunConfigHarness(
9191"utf8",
9292);
939394-process.env.OPENCLAW_TEST_FAST = "1";
95-process.env.OPENCLAW_CONFIG_PATH = configPath;
94+setTestEnvValue("OPENCLAW_TEST_FAST", "1");
95+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
9696clearConfigCache();
9797clearRuntimeConfigSnapshot();
9898@@ -117,8 +117,8 @@ describe("config cli integration", () => {
117117const envSnapshot = captureEnv(["OPENCLAW_CONFIG_PATH", "OPENCLAW_TEST_FAST"]);
118118try {
119119fs.writeFileSync(configPath, `${JSON.stringify({ gateway: { port: 18789 } }, null, 2)}\n`);
120-process.env.OPENCLAW_TEST_FAST = "1";
121-process.env.OPENCLAW_CONFIG_PATH = configPath;
120+setTestEnvValue("OPENCLAW_TEST_FAST", "1");
121+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
122122clearConfigCache();
123123clearRuntimeConfigSnapshot();
124124await runConfigSet({
@@ -152,8 +152,8 @@ describe("config cli integration", () => {
152152"utf8",
153153);
154154155-process.env.OPENCLAW_TEST_FAST = "1";
156-process.env.OPENCLAW_CONFIG_PATH = configPath;
155+setTestEnvValue("OPENCLAW_TEST_FAST", "1");
156+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
157157clearConfigCache();
158158clearRuntimeConfigSnapshot();
159159@@ -222,9 +222,9 @@ describe("config cli integration", () => {
222222"utf8",
223223);
224224225-process.env.OPENCLAW_TEST_FAST = "1";
226-process.env.OPENCLAW_CONFIG_PATH = configPath;
227-process.env.DISCORD_BOT_TOKEN = "test-token";
225+setTestEnvValue("OPENCLAW_TEST_FAST", "1");
226+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
227+setTestEnvValue("DISCORD_BOT_TOKEN", "test-token");
228228clearConfigCache();
229229clearRuntimeConfigSnapshot();
230230@@ -293,9 +293,9 @@ describe("config cli integration", () => {
293293"utf8",
294294);
295295296-process.env.OPENCLAW_TEST_FAST = "1";
297-process.env.OPENCLAW_CONFIG_PATH = configPath;
298-delete process.env.MISSING_TEST_SECRET;
296+setTestEnvValue("OPENCLAW_TEST_FAST", "1");
297+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
298+deleteTestEnvValue("MISSING_TEST_SECRET");
299299clearConfigCache();
300300clearRuntimeConfigSnapshot();
301301此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。