@@ -14,7 +14,7 @@ import path from "node:path";
|
14 | 14 | import { afterAll, beforeAll, describe, expect, it } from "vitest"; |
15 | 15 | import { clearConfigCache, clearRuntimeConfigSnapshot } from "../../config/config.js"; |
16 | 16 | import { clearSessionStoreCacheForTest } from "../../config/sessions/store.js"; |
17 | | -import { captureEnv } from "../../test-utils/env.js"; |
| 17 | +import { captureEnv, deleteTestEnvValue, setTestEnvValue } from "../../test-utils/env.js"; |
18 | 18 | import { APPROVALS_SCOPE } from "../method-scopes.js"; |
19 | 19 | import { startGatewayServer } from "../server.js"; |
20 | 20 | import { |
@@ -41,23 +41,23 @@ describe("plugin.approval.request turn-source routing (real gateway)", () => {
|
41 | 41 | |
42 | 42 | beforeAll(async () => { |
43 | 43 | envSnapshot = captureEnv(TEST_ENV_KEYS); |
44 | | -delete process.env.OPENCLAW_CONFIG_PATH; |
45 | | -delete process.env.OPENCLAW_GATEWAY_URL; |
46 | | -delete process.env.OPENCLAW_GATEWAY_TOKEN; |
47 | | -delete process.env.OPENCLAW_GATEWAY_PASSWORD; |
| 44 | +deleteTestEnvValue("OPENCLAW_CONFIG_PATH"); |
| 45 | +deleteTestEnvValue("OPENCLAW_GATEWAY_URL"); |
| 46 | +deleteTestEnvValue("OPENCLAW_GATEWAY_TOKEN"); |
| 47 | +deleteTestEnvValue("OPENCLAW_GATEWAY_PASSWORD"); |
48 | 48 | |
49 | 49 | tempHome = await fs.mkdtemp( |
50 | 50 | path.join(os.tmpdir(), "openclaw-plugin-approval-turn-source-e2e-"), |
51 | 51 | ); |
52 | 52 | const stateDir = path.join(tempHome, ".openclaw"); |
53 | 53 | await fs.mkdir(stateDir, { recursive: true }); |
54 | | -process.env.HOME = tempHome; |
55 | | -process.env.OPENCLAW_STATE_DIR = stateDir; |
| 54 | +setTestEnvValue("HOME", tempHome); |
| 55 | +setTestEnvValue("OPENCLAW_STATE_DIR", stateDir); |
56 | 56 | |
57 | 57 | const port = await getFreeGatewayPort(); |
58 | 58 | const token = "plugin-approval-turn-source-e2e-token"; |
59 | 59 | const url = `ws://127.0.0.1:${port}`; |
60 | | -process.env.OPENCLAW_GATEWAY_PORT = String(port); |
| 60 | +setTestEnvValue("OPENCLAW_GATEWAY_PORT", String(port)); |
61 | 61 | |
62 | 62 | server = await startGatewayServer(port, { |
63 | 63 | bind: "loopback", |
|