Skip to content

Commit 4ae7287

Browse files
committed
perf(test): avoid env cloning in docker-setup suite
1 parent 7e065d9 commit 4ae7287

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/docker-setup.test.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,26 @@ function createEnv(
6262
sandbox: DockerSetupSandbox,
6363
overrides: Record<string, string | undefined> = {},
6464
): NodeJS.ProcessEnv {
65-
return {
66-
...process.env,
65+
const env: NodeJS.ProcessEnv = {
6766
PATH: `${sandbox.binDir}:${process.env.PATH ?? ""}`,
67+
HOME: process.env.HOME ?? sandbox.rootDir,
68+
LANG: process.env.LANG,
69+
LC_ALL: process.env.LC_ALL,
70+
TMPDIR: process.env.TMPDIR,
6871
DOCKER_STUB_LOG: sandbox.logPath,
6972
OPENCLAW_GATEWAY_TOKEN: "test-token",
7073
OPENCLAW_CONFIG_DIR: join(sandbox.rootDir, "config"),
7174
OPENCLAW_WORKSPACE_DIR: join(sandbox.rootDir, "openclaw"),
72-
...overrides,
7375
};
76+
77+
for (const [key, value] of Object.entries(overrides)) {
78+
if (value === undefined) {
79+
delete env[key];
80+
} else {
81+
env[key] = value;
82+
}
83+
}
84+
return env;
7485
}
7586

7687
function resolveBashForCompatCheck(): string | null {

0 commit comments

Comments
 (0)