@@ -4,16 +4,17 @@ import path from "node:path";
44import { afterEach , describe , expect , it , vi } from "vitest" ;
55import type { OpenClawConfig } from "../../config/types.openclaw.js" ;
66import { withTempDir } from "../../test-helpers/temp-dir.js" ;
7+ import { deleteTestEnvValue , setTestEnvValue } from "../../test-utils/env.js" ;
78import type { MsgContext } from "../templating.js" ;
89import { resolveCurrentTurnImages } from "./current-turn-images.js" ;
910
1011const originalStateDirEnv = process . env . OPENCLAW_STATE_DIR ;
1112
1213function restoreProcessState ( ) {
1314 if ( originalStateDirEnv === undefined ) {
14- delete process . env . OPENCLAW_STATE_DIR ;
15+ deleteTestEnvValue ( " OPENCLAW_STATE_DIR" ) ;
1516 } else {
16- process . env . OPENCLAW_STATE_DIR = originalStateDirEnv ;
17+ setTestEnvValue ( " OPENCLAW_STATE_DIR" , originalStateDirEnv ) ;
1718 }
1819}
1920
@@ -33,7 +34,7 @@ describe("resolveCurrentTurnImages", () => {
3334 await fs . mkdir ( path . dirname ( attachmentPath ) , { recursive : true } ) ;
3435 await fs . mkdir ( cwd , { recursive : true } ) ;
3536 await fs . writeFile ( attachmentPath , imageBytes ) ;
36- process . env . OPENCLAW_STATE_DIR = stateDir ;
37+ setTestEnvValue ( " OPENCLAW_STATE_DIR" , stateDir ) ;
3738 vi . spyOn ( process , "cwd" ) . mockReturnValue ( cwd ) ;
3839
3940 const result = await resolveCurrentTurnImages ( {
0 commit comments