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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
I
InfoQ
博客园_首页
G
Google Developers Blog
爱范儿
爱范儿
Last Week in AI
Last Week in AI
量子位
阮一峰的网络日志
阮一峰的网络日志
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
月光博客
月光博客
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

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: isolate exec approval env · openclaw/openclaw@2844ec2
shakkernerd · 2026-06-20 · via Recent Commits to openclaw:main

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

22

import fs from "node:fs";

33

import path from "node:path";

44

import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

5+

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

56

import { makeTempDir } from "./exec-approvals-test-helpers.js";

6778

const requestJsonlSocketMock = vi.hoisted(() => vi.fn());

@@ -33,8 +34,7 @@ let resolveExecApprovalsTranscriptPath: ExecApprovalsModule["resolveExecApproval

3334

let saveExecApprovals: ExecApprovalsModule["saveExecApprovals"];

34353536

const tempDirs: string[] = [];

36-

const originalOpenClawHome = process.env.OPENCLAW_HOME;

37-

const originalOpenClawStateDir = process.env.OPENCLAW_STATE_DIR;

37+

const testEnvSnapshot = captureEnv(["OPENCLAW_HOME", "OPENCLAW_STATE_DIR"]);

38383939

beforeAll(async () => {

4040

({

@@ -64,16 +64,7 @@ beforeEach(() => {

64646565

afterEach(() => {

6666

vi.restoreAllMocks();

67-

if (originalOpenClawHome === undefined) {

68-

delete process.env.OPENCLAW_HOME;

69-

} else {

70-

process.env.OPENCLAW_HOME = originalOpenClawHome;

71-

}

72-

if (originalOpenClawStateDir === undefined) {

73-

delete process.env.OPENCLAW_STATE_DIR;

74-

} else {

75-

process.env.OPENCLAW_STATE_DIR = originalOpenClawStateDir;

76-

}

67+

testEnvSnapshot.restore();

7768

for (const dir of tempDirs.splice(0)) {

7869

fs.rmSync(dir, { recursive: true, force: true });

7970

}

@@ -82,8 +73,8 @@ afterEach(() => {

8273

function createHomeDir(): string {

8374

const dir = makeTempDir();

8475

tempDirs.push(dir);

85-

process.env.OPENCLAW_HOME = dir;

86-

delete process.env.OPENCLAW_STATE_DIR;

76+

setTestEnvValue("OPENCLAW_HOME", dir);

77+

deleteTestEnvValue("OPENCLAW_STATE_DIR");

8778

return dir;

8879

}

8980

@@ -144,7 +135,7 @@ describe("exec approvals store helpers", () => {

144135

it("uses OPENCLAW_STATE_DIR for default file and socket paths", () => {

145136

const dir = createHomeDir();

146137

const stateDir = path.join(dir, "custom-state");

147-

process.env.OPENCLAW_STATE_DIR = stateDir;

138+

setTestEnvValue("OPENCLAW_STATE_DIR", stateDir);

148139149140

expect(path.normalize(resolveExecApprovalsPath())).toBe(

150141

path.normalize(stateApprovalsFilePath(stateDir)),

@@ -182,7 +173,7 @@ describe("exec approvals store helpers", () => {

182173

})}\n`,

183174

"utf8",

184175

);

185-

process.env.OPENCLAW_STATE_DIR = stateDir;

176+

setTestEnvValue("OPENCLAW_STATE_DIR", stateDir);

186177187178

const resolved = resolveExecApprovals("main", {

188179

security: "full",

@@ -657,7 +648,7 @@ describe("exec approvals store helpers", () => {

657648

const linkedHome = `${realHome}-link`;

658649

tempDirs.push(realHome, linkedHome);

659650

fs.symlinkSync(realHome, linkedHome, "dir");

660-

process.env.OPENCLAW_HOME = linkedHome;

651+

setTestEnvValue("OPENCLAW_HOME", linkedHome);

661652662653

saveExecApprovals({ version: 1, defaults: { security: "full" }, agents: {} });

663654

@@ -674,7 +665,7 @@ describe("exec approvals store helpers", () => {

674665

fs.mkdirSync(linkedStateTarget, { recursive: true });

675666

fs.symlinkSync(realHome, linkedHome, "dir");

676667

fs.symlinkSync(linkedStateTarget, path.join(realHome, ".openclaw"), "dir");

677-

process.env.OPENCLAW_HOME = linkedHome;

668+

setTestEnvValue("OPENCLAW_HOME", linkedHome);

678669679670

expect(() =>

680671

saveExecApprovals({ version: 1, defaults: { security: "full" }, agents: {} }),