惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - Franky
V
V2EX
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 叶小钗
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
D
Docker
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: centralize plugin temp home env · openclaw/openclaw...
shakkernerd · 2026-06-25 · via Recent Commits to openclaw:main

@@ -2,6 +2,7 @@

22

import fs from "node:fs/promises";

33

import os from "node:os";

44

import path from "node:path";

5+

import { deleteTestEnvValue, setTestEnvValue } from "../../test-utils/env.js";

56

import { cleanupSessionStateForTest } from "../../test-utils/session-state-cleanup.js";

6778

type EnvValue = string | undefined | ((home: string) => string | undefined);

@@ -36,9 +37,9 @@ function snapshotEnv(): EnvSnapshot {

3637

function restoreEnv(snapshot: EnvSnapshot) {

3738

const restoreKey = (key: string, value: string | undefined) => {

3839

if (value === undefined) {

39-

delete process.env[key];

40+

deleteTestEnvValue(key);

4041

} else {

41-

process.env[key] = value;

42+

setTestEnvValue(key, value);

4243

}

4344

};

4445

restoreKey("HOME", snapshot.home);

@@ -60,19 +61,19 @@ function snapshotExtraEnv(keys: string[]): Record<string, string | undefined> {

6061

function restoreExtraEnv(snapshot: Record<string, string | undefined>) {

6162

for (const [key, value] of Object.entries(snapshot)) {

6263

if (value === undefined) {

63-

delete process.env[key];

64+

deleteTestEnvValue(key);

6465

} else {

65-

process.env[key] = value;

66+

setTestEnvValue(key, value);

6667

}

6768

}

6869

}

69707071

function setTempHome(base: string) {

71-

process.env.HOME = base;

72-

process.env.USERPROFILE = base;

72+

setTestEnvValue("HOME", base);

73+

setTestEnvValue("USERPROFILE", base);

7374

// Ensure tests using HOME isolation aren't affected by leaked OPENCLAW_HOME.

74-

delete process.env.OPENCLAW_HOME;

75-

process.env.OPENCLAW_STATE_DIR = path.join(base, ".openclaw");

75+

deleteTestEnvValue("OPENCLAW_HOME");

76+

setTestEnvValue("OPENCLAW_STATE_DIR", path.join(base, ".openclaw"));

76777778

if (process.platform !== "win32") {

7879

return;

@@ -81,8 +82,8 @@ function setTempHome(base: string) {

8182

if (!match) {

8283

return;

8384

}

84-

process.env.HOMEDRIVE = match[1];

85-

process.env.HOMEPATH = match[2] || "\\";

85+

setTestEnvValue("HOMEDRIVE", match[1]);

86+

setTestEnvValue("HOMEPATH", match[2] || "\\");

8687

}

87888889

async function allocateTempHomeBase(prefix: string): Promise<string> {

@@ -126,9 +127,9 @@ export async function withTempHome<T>(

126127

for (const [key, raw] of Object.entries(opts.env)) {

127128

const value = typeof raw === "function" ? raw(base) : raw;

128129

if (value === undefined) {

129-

delete process.env[key];

130+

deleteTestEnvValue(key);

130131

} else {

131-

process.env[key] = value;

132+

setTestEnvValue(key, value);

132133

}

133134

}

134135

}