@@ -9,7 +9,7 @@ import type { DeviceIdentity } from "../infra/device-identity.js";
|
9 | 9 | import { createEmptyPluginRegistry } from "../plugins/registry-empty.js"; |
10 | 10 | import { setActivePluginRegistry } from "../plugins/runtime.js"; |
11 | 11 | import type { DeviceAuthEntry } from "../shared/device-auth.js"; |
12 | | -import { captureEnv } from "../test-utils/env.js"; |
| 12 | +import { captureEnv, deleteTestEnvValue, setTestEnvValue } from "../test-utils/env.js"; |
13 | 13 | import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js"; |
14 | 14 | import { |
15 | 15 | loadConfigMock as getRuntimeConfig, |
@@ -331,12 +331,12 @@ describe("callGateway url resolution", () => {
|
331 | 331 | |
332 | 332 | beforeEach(() => { |
333 | 333 | envSnapshot.restore(); |
334 | | -delete process.env.OPENCLAW_ALLOW_INSECURE_PRIVATE_WS; |
335 | | -delete process.env.OPENCLAW_CONFIG_PATH; |
336 | | -delete process.env.OPENCLAW_GATEWAY_PORT; |
337 | | -delete process.env.OPENCLAW_GATEWAY_URL; |
338 | | -delete process.env.OPENCLAW_GATEWAY_TOKEN; |
339 | | -delete process.env.OPENCLAW_STATE_DIR; |
| 334 | +deleteTestEnvValue("OPENCLAW_ALLOW_INSECURE_PRIVATE_WS"); |
| 335 | +deleteTestEnvValue("OPENCLAW_CONFIG_PATH"); |
| 336 | +deleteTestEnvValue("OPENCLAW_GATEWAY_PORT"); |
| 337 | +deleteTestEnvValue("OPENCLAW_GATEWAY_URL"); |
| 338 | +deleteTestEnvValue("OPENCLAW_GATEWAY_TOKEN"); |
| 339 | +deleteTestEnvValue("OPENCLAW_STATE_DIR"); |
340 | 340 | resetGatewayCallMocks(); |
341 | 341 | }); |
342 | 342 | |
@@ -1220,8 +1220,8 @@ describe("buildGatewayConnectionDetails", () => {
|
1220 | 1220 | |
1221 | 1221 | it("falls back to the default config loader when test deps drift", () => { |
1222 | 1222 | const tempStateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-gateway-call-")); |
1223 | | -process.env.OPENCLAW_STATE_DIR = tempStateDir; |
1224 | | -process.env.OPENCLAW_CONFIG_PATH = path.join(tempStateDir, "missing-config.json"); |
| 1223 | +setTestEnvValue("OPENCLAW_STATE_DIR", tempStateDir); |
| 1224 | +setTestEnvValue("OPENCLAW_CONFIG_PATH", path.join(tempStateDir, "missing-config.json")); |
1225 | 1225 | try { |
1226 | 1226 | getRuntimeConfig.mockReturnValue({ gateway: { mode: "local", bind: "loopback" } }); |
1227 | 1227 | resolveGatewayPort.mockReturnValue(18800); |
@@ -2552,7 +2552,7 @@ describe("callGateway password resolution", () => {
|
2552 | 2552 | }); |
2553 | 2553 | |
2554 | 2554 | it.each(explicitAuthCases)("uses explicit $label when url override is set", async (testCase) => { |
2555 | | -process.env[testCase.envKey] = testCase.envValue; |
| 2555 | +setTestEnvValue(testCase.envKey, testCase.envValue); |
2556 | 2556 | const auth = { [testCase.authKey]: testCase.configValue } as { |
2557 | 2557 | password?: string; |
2558 | 2558 | token?: string; |
|