mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
perf(test): trim fixture and serialization overhead in integration suites
This commit is contained in:
@@ -8,12 +8,13 @@ const baseGitEnv = {
|
||||
GIT_CONFIG_NOSYSTEM: "1",
|
||||
GIT_TERMINAL_PROMPT: "0",
|
||||
};
|
||||
const baseRunEnv: NodeJS.ProcessEnv = { ...process.env, ...baseGitEnv };
|
||||
|
||||
const run = (cwd: string, cmd: string, args: string[] = [], env?: NodeJS.ProcessEnv) => {
|
||||
return execFileSync(cmd, args, {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, ...baseGitEnv, ...env },
|
||||
env: env ? { ...baseRunEnv, ...env } : baseRunEnv,
|
||||
}).trim();
|
||||
};
|
||||
|
||||
|
||||
@@ -84,10 +84,11 @@ function runScript(
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
} {
|
||||
const cacheKey = JSON.stringify({
|
||||
homeDir,
|
||||
extraEnv: Object.entries(extraEnv).toSorted(([a], [b]) => a.localeCompare(b)),
|
||||
});
|
||||
const extraEnvKey = Object.keys(extraEnv)
|
||||
.toSorted((a, b) => a.localeCompare(b))
|
||||
.map((key) => `${key}=${extraEnv[key] ?? ""}`)
|
||||
.join("\u0001");
|
||||
const cacheKey = `${homeDir}\u0000${extraEnvKey}`;
|
||||
const cached = runScriptCache.get(cacheKey);
|
||||
if (cached) {
|
||||
return cached;
|
||||
|
||||
Reference in New Issue
Block a user